Skip to content

Instantly share code, notes, and snippets.

@iamraghavan
Forked from danieldroit/google_one_tap.html
Last active December 11, 2022 05:57
Show Gist options
  • Save iamraghavan/ab2717533b94190e43bfc1b16a478daa to your computer and use it in GitHub Desktop.
Save iamraghavan/ab2717533b94190e43bfc1b16a478daa to your computer and use it in GitHub Desktop.
Google one tap
<!DOCTYPE html>
<html>
<head>
<title>Google oAuth One Tap Guid</title>
</head>
<body>
<div id="g_id_onload"
data-client_id="227588324050-267dv8s03k5q9mu57lun7adi5uc62vvm.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/[email protected]/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