php - Refresh a access token with google analytics api -
i try refresh access token google analytics api (php) i've invalid_grant error ... that's process:
1. save first acces token in database offline request, response is:
{"access_token":"ya29.ahes6zspmuykfx06bw89lnlfra5memwdthycuj6d7brmdcq","token_type":"bearer","expires_in":3600,"refresh_token":"1\/1xlo8pls2pb0nps-t-lt07jww_stbwyg3igrb08zbka","created":1338810086} 2. check token info, if "expires_in" < 0 try refresh token:
if ($infoat['expires_in'] <= 0) { $row = $database->loadobject("select refresh token id=1"); $client->refreshtoken($row['refresh']); } and i've invalid_grant error ...
any ? lot , sorry english ...
Comments
Post a Comment