From 6518da7d616bfbcef595bc9c842febbbc2753be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Baconnier?= Date: Thu, 4 Nov 2021 10:47:22 +0100 Subject: [PATCH] Fix refreshAccessToken not being called --- src/Clients/ZohoHttp.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Clients/ZohoHttp.php b/src/Clients/ZohoHttp.php index e503ebb..15f65d8 100644 --- a/src/Clients/ZohoHttp.php +++ b/src/Clients/ZohoHttp.php @@ -21,11 +21,8 @@ public function __call($method, $parameters) return $this->macroCall($method, $parameters); } - // todo; prevent refresh when using ::fake() - if (in_array($method, ['delete', 'get', 'head', 'patch', 'post', 'put', 'send'])) { - // Refresh the access token if needed before performing a request - $this->refreshAccessToken(); - } + // todo: prevent refresh when using ::fake() + $this->refreshAccessToken(); $response = tap($this->newPendingRequest(), function (PendingRequest $request) { @@ -58,7 +55,7 @@ public function hasAccessToken(): bool return app(AccessTokenRepository::class)->exists(); } - private function refreshAccessToken() + private function refreshAccessToken(): void { $provider = app(ZohoAuthProvider::class); $accessTokenRepository = app(AccessTokenRepository::class);