-
Notifications
You must be signed in to change notification settings - Fork 175
Problems with signin in the updated sample #239
Comments
"jwt is not active" means the id_token received from AAD is not valid util some time in the future. Seems either we get a bad id_token from AAD or there is a difference between the two clocks, I will see if I can reproduce and let you know. Thanks. |
Thxs @lovemaths Hmm... you say "not valid util some time in the future"... could this be a timezone issue? I'm at UTC+1 |
@SteenMolberg I am not sure what the issue is. I cannot reproduce the issue, the sample works fine for me. In lib/jsonWebToken.js, can you replace line 192:
with
This can tell me how much they differ when the error occurs next time (note ' is changed to ` in the error message). Also, please let me know what responseType you are using. Thanks. |
@lovemaths Now I have tested a LOT, and with very confusing results. The error seem to occur often when I log out and try to log back in with a different user. When the error occurs it's like I'm stuck. When trying to sign in I don't get to select the user but is tries to sign in with the last user. I suspect that the session is not cleared sometimes. I think I will try tessing with the MongoDB session handler to see if that makes a difference. Here are some sample logs from the error after making the change you asked for: {"name":"AzureAD: OIDC Passport Strategy","hostname":"STEEN_X1","pid":3928,"level":30,"msg":"authentication failed due to: In _validateResponse: jwt is not active, nbf: 1477548228, now: 1477548227163","time":"2016-10-27T06:03:47.163Z","v":0} I did not change the sample except the basic settings, so the responseType ín the config is "code id_token" I'm not sure at this point, how that maps to the settings in B2C. |
@SteenMolberg I figured it out based on your log. In id_token they round the nbf up, but passport round the time down. For example, nbf = 1477548228, now = 1477548227.163, so I should round the 'now' up to 1477548228. This problem can be fixed by changing the |
AAD rounds the nbf up, but we round the current time down, and this causes the 'jwt is not active' problem. For instance, if the current time is 1000.111 (seconds), then in id_token nbf is rounded up to 1001, but we round it down to 1000 and compare the time. The authentication then fails because the current time is before nbf.
AAD rounds the current time up to the nearest integer for the nbf value, but we round the current time down when we validate the nbf value. This fails the authentication before we thought the current time is before nbf and the token is not active yet.
Issue #239 Problems with signin in the updated sample
hi @lovemaths I had to add 1 sec to make it work consistantly...
If I just changed flow to ceil I got problems when I tried something like reset password and cancel or signin and cancel. |
@SteenMolberg Thank you for the feedback! |
@SteenMolberg Added your fix to the new release 3.0.1, which is published today. Thanks! |
For some reasons, I seem to have the same problem. Adding your line, I get the following: {
"name":"AzureAD: OIDC Passport Strategy",
"hostname":"961179c14c60","pid":6,"level":30,
"msg":"authentication failed due to: In _validateResponse: jwt is not active, nbf: 1511899838, now: 1511899537734",
"time":"2017-11-28T20:05:37.735Z","v":0
} Which results in a diff of precisely 301. Is it normal for it to be exactly one above the default |
I recently had the same problem. And to fix it I put the value 3600 in the |
I have tested out the updated sample (B2C-WebApp-OpenIDConnect-NodeJS) now, but have a lot of problems with the login. I keep getting this error:
"authentication failed due to: In _validateResponse: jwt is not active"
Can you help me out resolving what is going up?
Following the log it seems like the flow is working OK. I can enter the username and password and redirected back to the app. Following the log and the decoded token the corrected user seem to be returned, but still I get the error above,
The signup seems to work OK, but when return to the application I get the same error. Still in the decoded token log I can see the new user is returned.
I'm using the default session store for my testing of the sample.
Hope you can help me out. Thanks.
The text was updated successfully, but these errors were encountered: