我正在使用Gooogledrive API與php.Using它我已經從憑證部分檢索Refresh令牌.accesstoken在3600秒後過期。我的問題是如何從新的accesstoken此刷新token.I已經使用在谷歌PHP客戶端library.I給出的方法調用了refreshtoken(「refreshtoke」)的apiclient.My碼功能是繼使用已在googledrive api中檢索到的refreshtoken獲取新accesstoken
$client = new apiClient();
$client->setClientId('my-client-id');
$client->setClientSecret('my client-secret-key');
$client->setRedirectUri('my redirect uri');
$client->refreshToken('MY-retrieved-refresh-token');
,但我得到了以下錯誤: - 未捕獲的異常'apiAuthException'消息'錯誤刷新OAuth2令牌,消息:'{「error」:「invalid_grant」}。**
請幫幫我。一切休息的作品fine.But的accessToken3600秒到期後,不刷新
你設置你的訪問和刷新令牌?我沒有看到行$ client-> SetAccessToken($ tokens),其中$ token是jSON中的訪問和刷新標記。 – vicrabb
謝謝vicrabb.I明白了你的觀點。 –
難道還是你還有問題? – vicrabb