From 10cfae47a92332700dd48531d42051cbd60db41f Mon Sep 17 00:00:00 2001 From: Brooke Bryan Date: Fri, 28 May 2021 10:59:22 +0100 Subject: [PATCH] Support 401 responses --- src/ApiRequest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ApiRequest.php b/src/ApiRequest.php index 45eb8c6..ca4a3ce 100644 --- a/src/ApiRequest.php +++ b/src/ApiRequest.php @@ -102,7 +102,9 @@ function () { return $this->_getRawResult(); }, function (Exception $e) { - if($e->getCode() == 403 && stristr($e->getMessage(), 'token')) + $reset = $e->getCode() == 401; + $reset = $reset || $e->getCode() == 403 && stristr($e->getMessage(), 'token'); + if($reset) { $this->_connection->clearToken(); $this->_endpoint->clearToken();