We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 926f9a0 + a3ac547 commit 75d1c52Copy full SHA for 75d1c52
Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/AuthImpl.kt
@@ -423,8 +423,9 @@ internal class AuthImpl(
423
Auth.logger.d { "Session imported successfully." }
424
return
425
}
426
- if (session.expiresAt <= Clock.System.now()) {
427
- Auth.logger.d { "Session is expired. Handling expired session..." }
+ val thresholdDate = session.expiresAt - session.expiresIn.seconds * (1 - SESSION_REFRESH_THRESHOLD)
+ if (thresholdDate <= Clock.System.now()) {
428
+ Auth.logger.d { "Session is under the threshold date. Refreshing session..." }
429
tryImportingSession(
430
{ handleExpiredSession(session, config.alwaysAutoRefresh) },
431
{ importSession(session) }
0 commit comments