我正在使用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