我使用下面的代码进行Google登录。它在同一页面上工作,但我无法在其他页面注销用户。
<div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"></div>
<a href="#" onclick="signOut();">Sign out</a>
<script>
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
auth2.disconnect();
console.log('User signed out.');
document.location.href = "REDIRECT LINK";
});
}
</script>
如何在另一页上使用signOut()?