Skip to content

Instantly share code, notes, and snippets.

@fysherman
Created October 26, 2021 15:23
Show Gist options
  • Save fysherman/6b8b5b1eb720038ef4f306a2eb252cdd to your computer and use it in GitHub Desktop.
Save fysherman/6b8b5b1eb720038ef4f306a2eb252cdd to your computer and use it in GitHub Desktop.
Google signin button
// Function handle data response from sigin in action, use jwt to decode data
function handleCredentialResponse(response) {
const responseDecode = jwt_decode(response.credential);
}
function initGGAuth() {
google.accounts.id.initialize({
client_id: CLIENT_ID,
callback: handleCredentialResponse
});
google.accounts.id.renderButton(
document.getElementById("gg-signin-btn"),
{ type: 'icon', shape: 'circle', theme: "outline", width: '48' } // customization attributes
);
}
window.onload = initGGAuth;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment