EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
oauth handle response fix
Yuri Kuznetsov865f72dbc5ac
diff --git a/application/Espo/Core/ExternalAccount/Clients/OAuth2Abstract.php b/application/Espo/Core/ExternalAccount/Clients/OAuth2Abstract.phpindex ed076d17c9..88df421ca1 100644--- a/application/Espo/Core/ExternalAccount/Clients/OAuth2Abstract.php+++ b/application/Espo/Core/ExternalAccount/Clients/OAuth2Abstract.php@@ -544,9 +544,15 @@ abstract class OAuth2Abstract implements IClientreturn ['action' => 'renew'];}- if ($response['code'] == 400 && !empty($response['result'])) {- if ($response['result']['error'] == 'invalid_token') {- return ['action' => 'refreshToken'];+ if ($response['code'] == 400) {+ $result = $response['result'] ?? null;++ if (is_array($result)) {+ $error = $result['error'] ?? null;++ if ($error === 'invalid_token') {+ return ['action' => 'refreshToken'];+ }}}