forked from baron/baron-sso
fix: resolve admin session infinite reload loop and sync auth state
- Prevent infinite redirection loop by clearing oidc-client user state on 401 errors. - Sync apiClient request interceptor to use userManager.getUser() for reliable token retrieval. - Add extensive console logs for better session issue diagnosis. - Fix TS error in LoginPage by updating button variant. - Revert 'ae03fe1' (updated playwright fixtures to real domain) as requested.
This commit is contained in:
@@ -29,18 +29,28 @@ export function shouldAttemptSlidingSessionRenew({
|
||||
}
|
||||
|
||||
if (typeof expiresAtSec !== "number") {
|
||||
console.debug("[sessionSliding] expiresAtSec is not a number, skipping renew");
|
||||
return false;
|
||||
}
|
||||
|
||||
const remainingMs = expiresAtSec * 1000 - nowMs;
|
||||
if (remainingMs <= 0 || remainingMs > thresholdMs) {
|
||||
const remainingMin = Math.floor(remainingMs / 1000 / 60);
|
||||
|
||||
if (remainingMs <= 0) {
|
||||
console.debug("[sessionSliding] Session already expired, skipping renew");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (remainingMs > thresholdMs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nowMs - lastAttemptAtMs < throttleMs) {
|
||||
console.debug("[sessionSliding] Throttling renewal attempt");
|
||||
return false;
|
||||
}
|
||||
|
||||
console.info(`[sessionSliding] Attempting sliding session renewal. Remaining: ${remainingMin}m`);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -60,17 +70,27 @@ export function shouldAttemptUnlimitedSessionRenew({
|
||||
}
|
||||
|
||||
if (typeof expiresAtSec !== "number") {
|
||||
console.debug("[sessionSliding] expiresAtSec is not a number, skipping unlimited renew");
|
||||
return false;
|
||||
}
|
||||
|
||||
const remainingMs = expiresAtSec * 1000 - nowMs;
|
||||
if (remainingMs <= 0 || remainingMs > thresholdMs) {
|
||||
const remainingMin = Math.floor(remainingMs / 1000 / 60);
|
||||
|
||||
if (remainingMs <= 0) {
|
||||
console.debug("[sessionSliding] Session already expired, skipping unlimited renew");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (remainingMs > thresholdMs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nowMs - lastAttemptAtMs < throttleMs) {
|
||||
console.debug("[sessionSliding] Throttling unlimited renewal attempt");
|
||||
return false;
|
||||
}
|
||||
|
||||
console.info(`[sessionSliding] Attempting unlimited session renewal. Remaining: ${remainingMin}m`);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user