@sourceregistry/sveltekit-oidc 1.5.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -136,9 +136,15 @@
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
const timeoutMs = Math.max(0, session.expiresAt * 1000 - Date.now());
|
|
139
|
-
const timer = window.setTimeout(() => {
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
const timer = window.setTimeout(async () => {
|
|
140
|
+
// Silent revalidate first — server's maybeRefreshSession will refresh
|
|
141
|
+
// the token if a valid refresh_token exists. Only redirect if the
|
|
142
|
+
// session comes back unauthenticated after that.
|
|
143
|
+
await revalidate();
|
|
144
|
+
if (!session?.isAuthenticated) {
|
|
145
|
+
status = 'expired';
|
|
146
|
+
void handleRedirect(redirectOnExpired);
|
|
147
|
+
}
|
|
142
148
|
}, timeoutMs);
|
|
143
149
|
|
|
144
150
|
return () => window.clearTimeout(timer);
|