Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 627 Bytes

google-auth.md

File metadata and controls

27 lines (20 loc) · 627 Bytes

Login with Google steps

<script src="https://apis.google.com/js/api.js"></script>
  • Initialize Gapi
gapi.load("auth2", async function() {
    await gapi.auth2.init({ client_id: 'client_id, created in step 1' });
});
  • SignIn
const authInstance = gapi.auth2.getAuthInstance();
const result = authInstance.signIn();

// Handle the result.
console.log('Login result', result);
  • Get access_token and send it to the backend to exchange for a local jwt