-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Brian Sztamfater
committed
Dec 15, 2020
1 parent
c8b5efe
commit 41c9821
Showing
8 changed files
with
350 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<html> | ||
<head> | ||
<title>Google Sign-In Demo</title> | ||
<script src="https://apis.google.com/js/platform.js" async defer></script> | ||
<meta name="google-signin-client_id" content="865204013155-2eph0vh7lttm2lnq8kt2im8tb7hd3o2j.apps.googleusercontent.com"> | ||
</head> | ||
<body> | ||
<div class="g-signin2" data-onsuccess="onSignIn"></div> | ||
<script> | ||
function onSignIn(googleUser) { | ||
var id_token = googleUser.getAuthResponse().id_token; | ||
var xhr = new XMLHttpRequest(); | ||
xhr.open('POST', '/google'); | ||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | ||
xhr.onload = function() { | ||
console.log('Signed in as: ' + xhr.responseText); | ||
}; | ||
xhr.send('idtoken=' + id_token); | ||
} | ||
</script> | ||
|
||
<a href="#" onclick="signOut();">Sign out</a> | ||
<script> | ||
function signOut() { | ||
var auth2 = gapi.auth2.getAuthInstance(); | ||
auth2.signOut().then(function () { | ||
console.log('User signed out.'); | ||
}); | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.