php - Refresh oauth2 token google api and HWIOAuthBundle -
how can refresh token ? use google api token - work can't find how refresh it, in example dont save expired time. require
`access_type: offline `
then
$client = new google_client(); //$client->setclientid($googleclientid); $client->setapplicationname($googleappname); $client->setclientid($this->user->getgoogleid()); $client->setaccesstype('offline');
if token valid can work when expired try
$token = [ 'access_token' => $this->user->getgoogleaccesstoken(), 'expires_in' => (new \datetime())->modify('-1 year')->gettimestamp(), ];
i put date because in example don't save expired time
https://gist.github.com/danvbe/4476697
$client->setaccesstoken($token); if($client->isaccesstokenexpired()){ $refreshedtoken = $client->refreshtoken($client->getaccesstoken());
here have error
array:2 [▼ "error" => "invalid_request" "error_description" => "could not determine client id request." ]
there hwiauthbundle method refresh token ? why not work google_client refresh ?
Comments
Post a Comment