Skip to content

Instantly share code, notes, and snippets.

@Loupeznik
Last active June 16, 2022 08:04
Show Gist options
  • Save Loupeznik/db15e3a2fccd9ee4f5d326aa62d790ff to your computer and use it in GitHub Desktop.
Save Loupeznik/db15e3a2fccd9ee4f5d326aa62d790ff to your computer and use it in GitHub Desktop.
Google sign-in
<html>
<body>
<div>
<button onClick="ggl()">sign in with gugul</button>
</div>
<script>
function ggl() {
const redirectUri = 'http://localhost:3000/redir.html';
const scope = 'openid%20profile%20email';
const clientId = 'xxx.apps.googleusercontent.com';
window.location.href = `https://accounts.google.com/o/oauth2/v2/auth?response_type=code&access_type=offline&scope=${scope}&redirect_uri=${redirectUri}&client_id=${clientId}&prompt=consent`;
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment