// Fixed Gapi v3.0 token refresh
This commit is contained in:
@@ -98,15 +98,18 @@ class Gapi extends Module
|
|||||||
{
|
{
|
||||||
$params = array(
|
$params = array(
|
||||||
'client_id' => Configuration::get('PS_GAPI30_CLIENT_ID'),
|
'client_id' => Configuration::get('PS_GAPI30_CLIENT_ID'),
|
||||||
'client_secret' => Configuration::get('PS_GAPI30_CLIENT_SECRET'),
|
'client_secret' => Configuration::get('PS_GAPI30_CLIENT_SECRET')
|
||||||
'grant_type' => 'authorization_code'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// https://developers.google.com/accounts/docs/OAuth2WebServer#offline
|
// https://developers.google.com/accounts/docs/OAuth2WebServer#offline
|
||||||
if (Configuration::get('PS_GAPI30_REFRESH_TOKEN'))
|
if (Configuration::get('PS_GAPI30_REFRESH_TOKEN'))
|
||||||
|
{
|
||||||
|
$params['grant_type'] = 'refresh_token';
|
||||||
$params['refresh_token'] = Configuration::get('PS_GAPI30_REFRESH_TOKEN');
|
$params['refresh_token'] = Configuration::get('PS_GAPI30_REFRESH_TOKEN');
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$params['grant_type'] = 'authorization_code';
|
||||||
$params['code'] = Configuration::get('PS_GAPI30_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';
|
$params['redirect_uri'] = Tools::getShopDomain(true, false).__PS_BASE_URI__.'modules/'.$this->name.'/oauth2callback.php';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user