Closed
Description
Reproduction
oauth.configure({
clientId: environment.openIdConnect.clientId,
issuer: environment.openIdConnect.issuer,
scope: "openid profile email",
redirectUri: window.location.origin + "/",
silentRefreshRedirectUri: window.location.origin + "/assets/silent-refresh.html",
timeoutFactor: 0.002,
});
oauth.setStorage(localStorage);
oauth.tokenValidationHandler = new JwksValidationHandler();
oauth.setupAutomaticSilentRefresh();
- log in
- Press F5 to reload the app
- Wait a bit for the token refresh timeout (which is extra short, to simplify testing)
Expected: Token is refreshed
Actual: Token is not refreshed
Cause
setupAccessTokenTimer()
is not invoked, because the service constructor calls restartRefreshTimerIfStillLoggedIn()
before the storage is set, causing hasValidAccessToken()
to return false.
As an aside, calcTimeout()
applies the timeoutFactor
relative to the current time. If an almost expired token is reloaded from local storage, the computed grace period may be too short to perform the refresh. Perhaps it would be better to use a fixed size grace period instead?
Metadata
Metadata
Assignees
Labels
No labels