@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
- status = 'expired';
141
- void handleRedirect(redirectOnExpired);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sourceregistry/sveltekit-oidc",
3
- "version": "1.5.0",
3
+ "version": "1.6.1",
4
4
  "description": "OIDC authentication helpers for SvelteKit applications",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {