Skip to content

Commit 066fc68

Browse files
committed
Fix issue with refresh token logic
The API was updated so that expiresIn can no longer be below 0.
1 parent ff2ec61 commit 066fc68

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/gkApi.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ export const fetchProviderToken = async (provider: Provider) => {
151151
const payload = await res.json();
152152
const providerToken = payload.data as ProviderToken;
153153
// Attempt to refresh expired OAuth tokens. Note: GitHub tokens don't expire.
154-
if (provider !== 'github' && providerToken.expiresIn < 0 && providerToken.type === 'oauth') {
154+
// We also refresh tokens that are about to expire in 60 seconds (expiresIn is in seconds).
155+
if (provider !== 'github' && providerToken.expiresIn < 60 && providerToken.type === 'oauth') {
155156
return refreshProviderToken(provider);
156157
}
157158

0 commit comments

Comments
 (0)