为什么我不能使用grantOfflineAccess? JavaScript的

时间:2017-04-26 18:00:17

标签: javascript google-oauth google-signin

我正在做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>

0 个答案:

没有答案