From 0337992a35066820f56382d912f332a5c5e63887 Mon Sep 17 00:00:00 2001 From: Raistlfiren Date: Thu, 5 Dec 2024 17:04:26 -0600 Subject: [PATCH] Fixed updating access token. --- src/Http/GarminClient/GarminAuthenticator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Http/GarminClient/GarminAuthenticator.php b/src/Http/GarminClient/GarminAuthenticator.php index b413210..a0c0f9b 100644 --- a/src/Http/GarminClient/GarminAuthenticator.php +++ b/src/Http/GarminClient/GarminAuthenticator.php @@ -76,7 +76,9 @@ public function authenticate() } // Access token must be expired so lets refresh it - if ($oauthData['refresh_token_expires_at'] < time()) { + if ($oauthData['refresh_token_expires_at'] > time()) { + $this->fetchConsumerCredentials(); + // Sweet the refresh token is still good so lets refresh the access token $oauthData = $this->exchangeOauth1TokenForOauth2Token($oauthData['token'], $oauthData['token_secret']); $this->refreshFile($filePath, $oauthData);