Skip to content

Commit

Permalink
Fix refreshAccessToken not being called
Browse files Browse the repository at this point in the history
  • Loading branch information
cbaconnier committed Nov 4, 2021
1 parent c251898 commit 6518da7
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/Clients/ZohoHttp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 6518da7

Please sign in to comment.