// Fixed Gapi v3.0 token refresh

This commit is contained in:
Damien Metzger
2013-09-05 11:12:58 +02:00
parent 009536d3f4
commit 95c9edd87a
+5 -2
View File
@@ -98,15 +98,18 @@ class Gapi extends Module
{
$params = array(
'client_id' => Configuration::get('PS_GAPI30_CLIENT_ID'),
'client_secret' => Configuration::get('PS_GAPI30_CLIENT_SECRET'),
'grant_type' => 'authorization_code'
'client_secret' => Configuration::get('PS_GAPI30_CLIENT_SECRET')
);
// https://developers.google.com/accounts/docs/OAuth2WebServer#offline
if (Configuration::get('PS_GAPI30_REFRESH_TOKEN'))
{
$params['grant_type'] = 'refresh_token';
$params['refresh_token'] = Configuration::get('PS_GAPI30_REFRESH_TOKEN');
}
else
{
$params['grant_type'] = 'authorization_code';
$params['code'] = Configuration::get('PS_GAPI30_AUTHORIZATION_CODE');
$params['redirect_uri'] = Tools::getShopDomain(true, false).__PS_BASE_URI__.'modules/'.$this->name.'/oauth2callback.php';
}