mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
Fix add missing message once token has been saved
This commit is contained in:
@@ -249,16 +249,26 @@ if (!GETPOST('code')) {
|
||||
|
||||
$db->begin();
|
||||
|
||||
// This requests the token from the received OAuth code (call of the https://oauth2.googleapis.com/token endpoint)
|
||||
// Result is stored into object managed by class DoliStorage into includes/OAuth/Common/Storage/DoliStorage.php and into database table llx_oauth_token
|
||||
$token = $apiService->requestAccessToken(GETPOST('code'), $state);
|
||||
try {
|
||||
// This requests the token from the received OAuth code (call of the https://oauth2.googleapis.com/token endpoint)
|
||||
// Result is stored into object managed by class DoliStorage into includes/OAuth/Common/Storage/DoliStorage.php and into database table llx_oauth_token
|
||||
$token = $apiService->requestAccessToken(GETPOST('code'), $state);
|
||||
} catch (Exception $e) {
|
||||
dol_syslog("Failed to get token with requestAccessToken: ".$e->getMessage(), LOG_ERR);
|
||||
setEventMessages("Failed to get token with requestAccessToken: ".$e->getMessage(), null, 'errors');
|
||||
$errorincheck++;
|
||||
}
|
||||
|
||||
// The refresh token is inside the object token if the prompt was forced only.
|
||||
//$refreshtoken = $token->getRefreshToken();
|
||||
//var_dump($refreshtoken);
|
||||
dol_syslog("requestAccessToken complete");
|
||||
|
||||
// Note: The extraparams has the 'id_token' than contains a lot of information about the user.
|
||||
$extraparams = $token->getExtraParams();
|
||||
$extraparams = array();
|
||||
if ($token) {
|
||||
$extraparams = $token->getExtraParams();
|
||||
}
|
||||
$jwt = explode('.', $extraparams['id_token']);
|
||||
|
||||
$username = '';
|
||||
@@ -347,6 +357,8 @@ if (!GETPOST('code')) {
|
||||
|
||||
dol_syslog($errormessage);
|
||||
}
|
||||
} else {
|
||||
setEventMessages("TokenSaved", null);
|
||||
}
|
||||
} else {
|
||||
// If call back to url for a OAUTH2 login
|
||||
|
||||
Reference in New Issue
Block a user