Skip to content

Commit ee24630

Browse files
Copilotgrdsdev
andauthored
fix(auth): apply expiryMargin buffer to hasExpired check in setSession() (#1331)
* Initial plan * fix(auth): apply expiryMargin buffer to hasExpired check in setSession() Co-authored-by: grdsdev <5923044+grdsdev@users.noreply.github.com> Agent-Logs-Url: https://github.com/supabase/supabase-flutter/sessions/80e8e775-47d3-4e08-aa75-07f715c27411 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: grdsdev <5923044+grdsdev@users.noreply.github.com>
1 parent 8946afa commit ee24630

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/gotrue/lib/src/gotrue_client.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,8 @@ class GoTrueClient {
778778
// Throws AuthInvalidJwtException if the token is malformed.
779779
final decoded = decodeJwt(accessToken);
780780
final exp = decoded.payload.exp;
781-
final hasExpired = exp == null || exp <= timeNow;
781+
final hasExpired =
782+
exp == null || exp <= timeNow + Constants.expiryMargin.inSeconds;
782783

783784
if (hasExpired) {
784785
return await _callRefreshToken(refreshToken);

0 commit comments

Comments
 (0)