diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php
index c69493ed9a5..001db7320a0 100644
--- a/htdocs/core/modules/oauth/google_oauthcallback.php
+++ b/htdocs/core/modules/oauth/google_oauthcallback.php
@@ -84,8 +84,11 @@ if ($action != 'delete' && empty($requestedpermissionsarray))
$apiService = $serviceFactory->createService('Google', $credentials, $storage, $requestedpermissionsarray);
// access type needed to have oauth provider refreshing token
+// alos note that a refresh token is sent only after a prompt
$apiService->setAccessType('offline');
+$apiService->setApprouvalPrompt('force');
+
$langs->load("oauth");
diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php
index baa5106ae93..ebcb9f3cebf 100644
--- a/htdocs/core/modules/printing/printgcp.modules.php
+++ b/htdocs/core/modules/printing/printgcp.modules.php
@@ -450,6 +450,7 @@ class printing_printgcp extends PrintingDriver
}
$responsedata = json_decode($response, true);
//$html .= '
'.print_r($responsedata,true).'
';
+ $html .= '';
$html .= '
';
$html .= '';
$html .= '| '.$langs->trans("Id").' | ';
@@ -483,10 +484,11 @@ class printing_printgcp extends PrintingDriver
else
{
$html .= '
';
- $html .= '| '.$langs->trans("None").' | ';
+ $html .= ''.$langs->trans("None").' | ';
$html .= '
';
}
$html .= '
';
+ $html .= '
';
$this->resprint = $html;
diff --git a/htdocs/includes/OAuth/OAuth2/Service/Google.php b/htdocs/includes/OAuth/OAuth2/Service/Google.php
index a8bb44d8238..0d49609dccb 100644
--- a/htdocs/includes/OAuth/OAuth2/Service/Google.php
+++ b/htdocs/includes/OAuth/OAuth2/Service/Google.php
@@ -140,12 +140,25 @@ class Google extends AbstractService
$this->accessType = $accessType;
}
+ // LDR CHANGE Add approval_prompt to force the prompt if value is set to 'force' so it force return of a "refresh token" in addition to "standard token"
+ public $approvalPrompt='auto';
+ public function setApprouvalPrompt($prompt)
+ {
+ if (!in_array($prompt, array('auto', 'force'), true)) {
+ // @todo Maybe could we rename this exception
+ throw new InvalidAccessTypeException('Invalid approuvalPrompt, expected either auto or force.');
+ }
+ $this->approvalPrompt = $prompt;
+ }
+
/**
* {@inheritdoc}
*/
public function getAuthorizationEndpoint()
{
- return new Uri('https://accounts.google.com/o/oauth2/auth?access_type=' . $this->accessType);
+ // LDR CHANGE Add approval_prompt to force the prompt if value is set to 'force' so it force return of a "refresh token" in addition to "standard token"
+ //return new Uri('https://accounts.google.com/o/oauth2/auth?access_type='.$this->accessType);
+ return new Uri('https://accounts.google.com/o/oauth2/auth?'.($this->approvalPrompt?'approval_prompt='.$this->approvalPrompt.'&':'').'access_type='.$this->accessType);
}
/**