Skip to content

Instantly share code, notes, and snippets.

@danieldroit
Forked from rodolfofadino/google_one_tap.html
Created January 28, 2022 13:40
Show Gist options
  • Save danieldroit/abaeb5b5ae4019f1d70f6813eb983616 to your computer and use it in GitHub Desktop.
Save danieldroit/abaeb5b5ae4019f1d70f6813eb983616 to your computer and use it in GitHub Desktop.
Google one tap
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="g_id_onload"
data-client_id="390285071447-nulpiuehvrjqg91cnah18sj52mlt9c2b.apps.googleusercontent.com"
data-callback="handleCredentialResponse">
</div>
<script src="https://accounts.google.com/gsi/client" async defer></script>
<script src="https://cdn.jsdelivr.net/npm/jwt-decode@2.2.0/build/jwt-decode.min.js"></script>
<script>
function handleCredentialResponse(response) {
var decodedToken = jwt_decode(response.credential);
console.log(decodedToken.name);
console.log(decodedToken.email);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment