Skip to content

EspoCRM – Open Source CRM Application

oauth handle response fix

Yuri Kuznetsov865f72dbc5ac
diff --git a/application/Espo/Core/ExternalAccount/Clients/OAuth2Abstract.php b/application/Espo/Core/ExternalAccount/Clients/OAuth2Abstract.php
index 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 IClient
return ['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'];
+ }
}
}