我正在做guide中的所有内容,但grantOfflineAccess()
方法是undefined
。哪里出错?
function handleClientLoad() {
gapi.load('auth2', function() {
auth2 = gapi.auth2.init({
client_id: OAUTH2_CLIENT_ID,
}).then(function(){
});
});
}
function signInClick() {
auth2.grantOfflineAccess().then(signInCallback);
}
<button id="signinButton" onclick="signInClick()">Sign in with Google</button>
<script async defer src="https://apis.google.com/js/api.js"
onload="this.onload=function(){};handleClientLoad()"
onreadystatechange="if (this.readyState === 'complete') this.onload()">
</script>
<script src="https://apis.google.com/js/platform.js" async defer></script>