Refresh a access token with google analytics api [closed]

落花浮王杯 提交于 2019-12-21 05:21:44

问题


I try to refresh an access token with the google analytics API (php) but I've always the invalid_grant error ... that's my process:

1. I save a first acces token in my database with a offline request, the response is:

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

2. I check the token info, if "expires_in" < 0 i try to refresh my token:

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

and I've a invalid_grant error ...

any help ? Thanks a lot and sorry for my english ...

来源:https://stackoverflow.com/questions/10882294/refresh-a-access-token-with-google-analytics-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!