Skip to content

Commit

Permalink
Merge pull request #66 from marcreichel/adjust-token-lifetime
Browse files Browse the repository at this point in the history
Adjust token lifetime
  • Loading branch information
marcreichel committed Feb 4, 2022
2 parents dbe0510 + f388e4e commit 1684cae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ApiHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static function retrieveAccessToken(): string
->json();

if (is_array($response) && isset($response['access_token']) && $response['expires_in']) {
Cache::put($accessTokenCacheKey, (string)$response['access_token'], (int)$response['expires_in']);
Cache::put($accessTokenCacheKey, (string)$response['access_token'], (int)$response['expires_in'] - 60);

$accessToken = $response['access_token'];
}
Expand Down
1 change: 1 addition & 0 deletions src/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,7 @@ private function fetchApi(bool $count = false): mixed
'Authorization' => 'Bearer ' . ApiHelper::retrieveAccessToken(),
])
->withBody($this->getQuery(), 'plain/text')
->retry(3, 100)
->post($endpoint)
->throw()
->json();
Expand Down

0 comments on commit 1684cae

Please sign in to comment.