我需要Google登录才能访问我的网站。我已经使用Google文档在我的login.html中实现了“登录按钮”。登录和注销都可以正常工作,但是如何在其他站点上检测到用户已登录?
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log('ID: ' + profile.getId());
console.log('Name: ' + profile.getName());
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail());
}
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
window.location.href='login.html';
console.log('User signed out.');
});
}