WIP: add basic stuff

This commit is contained in:
AJ ONeal 2019-08-05 19:51:35 -06:00 committed by AJ ONeal
parent 336941f584
commit 86e605f265
2 changed files with 21 additions and 0 deletions

16
public/app.js Normal file
View File

@ -0,0 +1,16 @@
'use strict';
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.
}
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
console.log('User signed out.');
});
}

View File

@ -105,3 +105,8 @@ You shouldn't use it for automated testing, because it will change, but it looks
}
</code></pre>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<a href="#" onclick="signOut();">Sign out</a>
<script src="app.js"></script>