-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Behaviour of addAccessTokenExpiring callback changed between 2.4.0 and 3.0.1 #1624
Comments
This MR is touching that area, but i have not seen why that should produce what you see.
|
@pamapa I simplified the code as follows in order to try to track down the issue.
as you can see the The only difference, that I can spot in the debug logs is that the log Let me know if I should test something else. Attached you find the console logs (with oidc-client-ts debug enabled). |
Agree, could it be that in the 3.x run the renew itself against the IdP server was slower due to the server itself? diff --git "a/log-oidc-client-ts_3.0.1.txt" "b/log-oidc-client-ts_2.4.0.txt"
index 5001ca7..9e3647d 100644
--- "a/log-oidc-client-ts_3.0.1.txt"
+++ "b/log-oidc-client-ts_2.4.0.txt"
@@ -1,9 +1,9 @@
-[Timer('Access token expired')] timer completes in 104 oidc-client-ts.js
-[Timer('Access token expiring')] timer completes in 8 oidc-client-ts.js
-[Timer('Access token expired')] timer completes in 99 oidc-client-ts.js
-[Timer('Access token expiring')] timer completes in 3 oidc-client-ts.js
-[Timer('Access token expired')] timer completes in 94 oidc-client-ts.js
-[Timer('Access token expiring')] timer completes in -2 oidc-client-ts.js
+[Timer('Access token expired')] timer completes in 106 oidc-client-ts.js
+[Timer('Access token expiring')] timer completes in 10 oidc-client-ts.js
+[Timer('Access token expired')] timer completes in 101 oidc-client-ts.js
+[Timer('Access token expiring')] timer completes in 5 oidc-client-ts.js
+[Timer('Access token expired')] timer completes in 96 oidc-client-ts.js
+[Timer('Access token expiring')] timer completes in 0 oidc-client-ts.js
[Timer('Access token expiring')] cancel: begin oidc-client-ts.js
[Timer('Access token expiring')] raise: oidc-client-ts.js
[SilentRenewService] _tokenExpiring: begin oidc-client-ts.js
@@ -11,6 +11,7 @@
[UserManager] _loadUser: begin oidc-client-ts.js
[WebStorageStateStore] get('user:https://my-oidc-provider.com:443/:my-oidc-client-id'): begin oidc-client-ts.js
+[OIDC] Token expiring in 89s --> silent refresh token will start soon ... oidc.js:101
[UserManager] _loadUser: user storageString loaded oidc-client-ts.js
[User.fromStorageString] begin oidc-client-ts.js
@@ -23,10 +24,10 @@
[JsonService] getJson: begin oidc-client-ts.js
[JsonService] appendExtraHeaders: begin oidc-client-ts.js
[JsonService] getJson: url: https://my-oidc-provider.com:443/.well-known/openid-configuration oidc-client-ts.js
-[Timer('Access token expired')] timer completes in 89 oidc-client-ts.js
+[Timer('Access token expired')] timer completes in 91 oidc-client-ts.js
XHRGET
https://my-oidc-provider.com/.well-known/openid-configuration
-[HTTP/2 200 180ms]
+[HTTP/3 200 139ms]
[JsonService] getJson: HTTP response received, status 200 oidc-client-ts.js
[MetadataService] getMetadata: merging remote JSON with seed metadata oidc-client-ts.js
@@ -37,7 +38,7 @@ https://my-oidc-provider.com/.well-known/openid-configuration
[JsonService] postForm: url: https://my-oidc-provider.com/oauth/token oidc-client-ts.js
XHRPOST
https://my-oidc-provider.com/oauth/token
-[HTTP/2 200 4361ms]
+[HTTP/3 200 228ms]
[JsonService] postForm: HTTP response received, status 200 oidc-client-ts.js
[TokenClient] exchangeRefreshToken: got response oidc-client-ts.js
@@ -66,7 +67,7 @@ oidc-client-ts.js
[Timer('Access token expired')] cancel: begin oidc-client-ts.js
[Timer('Access token expired')] init: using duration 121 oidc-client-ts.js
[Event('User loaded')] raise:
-Object { id_token: "yyy", session_state: null, access_token: "yyy", refresh_token: "xxx", token_type: "Bearer", scope: "openid profile email offline_access", profile: {…}, expires_at: 1724660322, state: undefined, url_state: undefined }
+Object { id_token: "yyy", session_state: null, access_token: "yyy", refresh_token: "xxx", token_type: "Bearer", scope: "openid profile email offline_access", profile: {…}, expires_at: 1724660191, state: undefined, url_state: undefined }
oidc-client-ts.js
[UserManager] getUser: begin oidc-client-ts.js
@@ -74,20 +75,20 @@ oidc-client-ts.js
[WebStorageStateStore] get('user:https://my-oidc-provider.com:443/:my-oidc-client-id'): begin oidc-client-ts.js
[UserManager] _loadUser: user storageString loaded oidc-client-ts.js
[User.fromStorageString] begin oidc-client-ts.js
+[SilentRenewService] _tokenExpiring: silent token renewal successful oidc-client-ts.js
[UserManager] getUser: user loaded oidc-client-ts.js
[UserManagerEvents] load: begin oidc-client-ts.js
[UserManagerEvents] load: access token present, remaining duration: 120 oidc-client-ts.js
[UserManagerEvents] load: registering expiring timer, raising in 30 seconds oidc-client-ts.js
[Timer('Access token expiring')] init: begin oidc-client-ts.js
-[Timer('Access token expiring')] init: skipping since already initialized for expiration at 1724660232 oidc-client-ts.js
+[Timer('Access token expiring')] init: skipping since already initialized for expiration at 1724660101 oidc-client-ts.js
[UserManagerEvents] load: registering expired timer, raising in 121 seconds oidc-client-ts.js
[Timer('Access token expired')] init: begin oidc-client-ts.js
-[Timer('Access token expired')] init: skipping since already initialized for expiration at 1724660323 oidc-client-ts.js
+[Timer('Access token expired')] init: skipping since already initialized for expiration at 1724660192 oidc-client-ts.js
-info: [OIDC] Token refreshed successfully! New token valid until 2024-08-26T10:18:42+02:00 IwsLogger.js
+info: [OIDC] Token refreshed successfully! New token valid until 2024-08-26T10:16:31+02:00 IwsLogger.js
debug: [OIDC] Auth0 'digitalPortfolioAccess/roles' claim detected ... using claim 'digitalPortfolioAccess/roles' to obtain user roles IwsLogger.js
-[SilentRenewService] _tokenExpiring: silent token renewal successful oidc-client-ts.js
-[OIDC] Token expiring in 120s --> silent refresh token will start soon ... oidc.js:101
[Timer('Access token expiring')] timer completes in 25 oidc-client-ts.js
[Timer('Access token expired')] timer completes in 116 oidc-client-ts.js What is suspicious is that i do not see logs like |
@pamapa we have traced the problem and it is definitely related to #1312 respectively #1313. The oidc-client-ts/src/utils/Event.ts Line 38 in 34528bf
As a result of the In our case (as it is only for logging/debugging purposes) it does no harm. But for anyone else doing real live stuff in |
@m4rc77 Thanks for tracking this down. I have to think about this. |
We have a running application with oidc-client-ts version 2.4.0. We are using
automaticSilentRenew: true
,accessTokenExpiringNotificationTimeInSeconds: 60
and have registered a callback viaaddAccessTokenExpiring
for logging purposes.We did a test-update to from 2.4.0 to 3.0.1 and realized a change in behavior.
With 2.4.0:
addAccessTokenExpiring
is called before the token is refreshedWith 3.0.1
addAccessTokenExpiring
is called after the token is refreshed !?!Could this be a Bug?
The text was updated successfully, but these errors were encountered: