fix google disconnect issue

This commit is contained in:
Arjun 2026-02-12 14:13:54 +05:30
parent 6c9ccc0f95
commit 56fd33e4fe
2 changed files with 6 additions and 6 deletions

View file

@ -213,11 +213,12 @@ export async function refreshTokens(
}
/**
* Check if tokens are expired
* Check if tokens are expired (or will expire within the buffer period)
*/
const EXPIRY_BUFFER_SECONDS = 5 * 60; // Refresh 5 minutes before expiry
export function isTokenExpired(tokens: OAuthTokens): boolean {
const now = Math.floor(Date.now() / 1000);
return tokens.expires_at <= now;
return tokens.expires_at <= now + EXPIRY_BUFFER_SECONDS;
}
/**

View file

@ -79,10 +79,9 @@ export class FSOAuthRepo implements IOAuthRepo {
if (!tokens) {
return false;
}
// Check if token is expired
const now = Math.floor(Date.now() / 1000);
return tokens.expires_at > now;
// Connected as long as we have a refresh token (access tokens can be refreshed on demand)
return tokens.refresh_token != null;
}
async getConnectedProviders(): Promise<string[]> {