@umbraco-cms/backoffice 17.6.0-rc → 17.6.0
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.
|
@@ -446,13 +446,18 @@ export class UmbAuthContext extends UmbContextBase {
|
|
|
446
446
|
}
|
|
447
447
|
/**
|
|
448
448
|
* Performs the actual refresh request and applies the result.
|
|
449
|
-
* A definitive rejection (e.g. `invalid_grant`) marks the session as dead
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
*
|
|
449
|
+
* A definitive rejection (e.g. `invalid_grant`) marks the session as dead, so every
|
|
450
|
+
* subsequent API request does not fire its own doomed refresh attempt. When the rejected
|
|
451
|
+
* refresh belonged to an established session, the user is also timed out so the
|
|
452
|
+
* re-authentication flow starts. Transient failures (network errors, 5xx) leave the
|
|
453
|
+
* session state untouched so a later attempt can retry.
|
|
453
454
|
* @returns {Promise<boolean>} True if the refresh succeeded, otherwise false.
|
|
454
455
|
*/
|
|
455
456
|
async #performRefresh() {
|
|
457
|
+
// A rejection with no session in hand means nobody is signed in — not that a session
|
|
458
|
+
// expired. Timing out there re-authenticates in a popup and leaves the caller to
|
|
459
|
+
// navigate, where a cold boot needs the ordinary login redirect.
|
|
460
|
+
const hadSession = !!this.#session.getValue();
|
|
456
461
|
const result = await this.#client.refreshToken();
|
|
457
462
|
if (result.response) {
|
|
458
463
|
this.#updateSession(result.response.expiresIn, result.response.issuedAt);
|
|
@@ -460,7 +465,9 @@ export class UmbAuthContext extends UmbContextBase {
|
|
|
460
465
|
}
|
|
461
466
|
if (result.fatal) {
|
|
462
467
|
this.#sessionDead = true;
|
|
463
|
-
|
|
468
|
+
if (hadSession) {
|
|
469
|
+
this.timeOut();
|
|
470
|
+
}
|
|
464
471
|
}
|
|
465
472
|
return false;
|
|
466
473
|
}
|