Google Sign-in with Google Identity Service
npm install google-login-gsi !NPM
Use Google Identity Services with your Javascript App easily
- With NPM
``bash`
npm i --save google-login-gsi
`js
import * as gAuth from "@types/google-login-gsi";
// or
const gAuth = require('google-login-gsi');
`
js
const response = await gAuth.signIn({
client_id: YOUR_GOOGLE_CLIENT_ID,
scope: "profile email" // You can update your scope here
});
`$3
`js
const isLoggedIn = await gAuth.isLoggedIn(); // Return boolean
`$3
`js
const user = await gAuth.getUserInfo(); // Return an object
`$3
`js
gAuth.signOut();
``