diff options
Diffstat (limited to 'website/sandbox/learnpianochords/src/server/index.html')
-rw-r--r-- | website/sandbox/learnpianochords/src/server/index.html | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/website/sandbox/learnpianochords/src/server/index.html b/website/sandbox/learnpianochords/src/server/index.html index ce80faf0d501..459a5c8c8250 100644 --- a/website/sandbox/learnpianochords/src/server/index.html +++ b/website/sandbox/learnpianochords/src/server/index.html @@ -11,11 +11,18 @@ <a href="#" onclick="signOut();">Sign out</a> <script> function onSignIn(googleUser) { - var profile = googleUser.getBasicProfile(); - console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead. - console.log('Name: ' + profile.getName()); - console.log('Image URL: ' + profile.getImageUrl()); - console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present. + var idToken = googleUser.getAuthResponse().id_token; + fetch('http://localhost:3000/verify', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + idToken: idToken, + }) + }) + .then(x => console.log(x)) + .catch(err => console.error(err)); } function signOut() { var auth2 = gapi.auth2.getAuthInstance(); |