From 34223cd392f215d5ffb8c74b2bdf417753534eb7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Mar 2023 17:14:07 +0100 Subject: [PATCH] Debug v17 --- htdocs/admin/emailcollector_card.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index d2a904fecf8..23ccea552e1 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -448,8 +448,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // We have to save the token because Google give it only once $refreshtoken = $tokenobj->getRefreshToken(); + //var_dump($tokenobj); - $tokenobj = $apiService->refreshAccessToken($tokenobj); + try { + $tokenobj = $apiService->refreshAccessToken($tokenobj); + } catch (Exception $e) { + throw new Exception("Failed to refresh access token: ".$e->getMessage()); + } $tokenobj->setRefreshToken($refreshtoken); $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); @@ -496,6 +501,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea 'authentication' => "login", ]); } + if (!$error) { try { // To emulate the command connect, you can run @@ -571,7 +577,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtml .= ''.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").''; } - $morehtml .= $form->textwithpicto('', 'connect string '.$connectstringserver); + $morehtml .= $form->textwithpicto('', 'Connect string = '.$connectstringserver.'
Option MAIN_IMAP_USE_PHPIMAP = '.getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref.'
'.$morehtml.'
', '', 0, '', '', 0, '');