刷新与谷歌分析API一个访问令牌[关闭](Refresh a access token with g

2019-07-29 18:03发布

我尝试刷新与谷歌分析API(PHP)的访问令牌,但我一直在invalid_grant错误 ......这是我的过程:

1.我省第一ACCES在我与脱机请求数据库的道理,回应是:

{"access_token":"ya29.AHES6ZSPMUyKfx06Bw89LnlfRa5mEmwdthyCUj6D7bRmDcQ","token_type":"Bearer","expires_in":3600,"refresh_token":"1\/1XLO8PLs2Pb0NPs-T-lt07jWW_STBWYG3IGRB08ZbkA","created":1338810086}

2.我检查令牌信息,如果“expires_in” <0我尝试刷新我的令牌:

if ($infoAt['expires_in'] <= 0) {
 $row = $database->loadObject("SELECT refresh from token WHERE id=1");
 $client->refreshToken($row['refresh']);
}

和我有一个invalid_grant错误...

任何帮助吗? 非常感谢和抱歉,我的英语水平?

文章来源: Refresh a access token with google analytics api [closed]