Google-api-php Refresh Token returns invalid_grant

前端 未结 5 678
离开以前
离开以前 2020-12-31 17:58

I\'ve nearly searched every result of the first page of google for this. But can\'t seem to find the answer. I\'m working with a refresh_token by Google\'s API and receiving

5条回答
  •  耶瑟儿~
    2020-12-31 18:15

    You'll get an "invalid_grant" error if you try to refresh when the token isn't expired.

    Instead of this:

    $client->refreshToken(file_get_contents('../_config/refreshtoken.conf'));
    

    Use this:

    $client->setAccessToken(file_get_contents('../_config/refreshtoken.conf'));
    

    Once your token expires you refresh should work.

提交回复
热议问题