22 lines
951 B
JavaScript
22 lines
951 B
JavaScript
|
function onSignIn(googleUser) {
|
|||
|
var profile = googleUser.getBasicProfile();
|
|||
|
console.log('ID: ' + profile.getId()); // Do not use this in the backend. This is raw, the id_token is the secure UNIQID
|
|||
|
console.log('ID Token: ' + googleUser.getAuthResponse().id_token); // This is your ID for the profile for SQL
|
|||
|
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.
|
|||
|
|
|||
|
document.getElementById("status").style.color = "green";
|
|||
|
document.getElementById("status").textContent = "Signed In";
|
|||
|
}
|
|||
|
|
|||
|
function signOut() {
|
|||
|
var auth2 = gapi.auth2.getAuthInstance();
|
|||
|
auth2.signOut().then(function () {
|
|||
|
console.log('User signed out.');
|
|||
|
document.getElementById("status").style.color = "red";
|
|||
|
document.getElementById("status").textContent = "Not Signed In";
|
|||
|
});
|
|||
|
|
|||
|
|
|||
|
}
|