-
Notifications
You must be signed in to change notification settings - Fork 70
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
The token is not valid yet #146
Comments
It means the computer clocks are not synchronized. Use ntp. |
Use NTP on the server where this flask application is running? |
You need the clocks properly synchronised everywhere - your Canvas server and your flask application server. The error means that there is a difference in the clocks and hence the application can't trust the token. |
Hello, I'm facing a similar issue but with servers having correct NTP configurations. Regards |
You can set the verify options already, by calling Rather than disabling the iat check altogether, I think what is needed is to add some leeway when calling jwt.decode, at https://github.com/dmitry-viskov/pylti1.3/blob/master/pylti1p3/message_launch.py#L715 Solutions are 1. patch the library, 2. extended MessageLaunch to override |
I agree with the response provided above. I was able to resolve the issue by adding the leeway parameter to the MessageLaunch. This adjustment accommodates the minor time discrepancy between the LMS and application servers without disabling the iat check altogether. |
I think it would be helpful for MessageLaunch to have a method to set the leeway passed to jwt.decode ( |
Thank you for your responses. |
No, it is also applied to the |
I finally got the time to work on this. Thank you again for your help. |
I started getting this error "pylti1p3.exception.LtiServiceException: HTTP response [https://uiowa.instructure.com/login/oauth2/token]: 400 - {"error":"invalid_request","error_description":"the 'iat' must not be in the future"}" It was working till today. Then I started getting this must not be in the future error. I have a leeway of 120. |
Do you mean you applied @sdiemer 's patch in order to set the leeway? Is your system clock synchronized correctly? 120 seconds is a very large discrepancy. |
A clock synchronization issue would explain why the problem just started. |
How do i disable the iat check? I've set the flag to false in set_jwt_verify_options. It doesnt seem to be doing anything, as I'm still getting the error. |
You should be able to call |
Wait, the error seems to be that Canvas is rejecting the |
Okay, thank you. I will try to reset the system clock in the morning. |
You are right. There is something going on with the "message_launch.has_nrps()" or "message_launch.get_nrps()". I removed this form my code, and seems to fix the error. I will take a look at these functions and how its effecting the iat token. I will share my finidng here, if any. |
Calls to those services generate a token which is set to the tool consumer (Canvas). The problem is with the |
pylti1p3.exception.LtiException: Can't decode id_token: The token is not yet valid (iat)
I'm getting this error. Everytime I try to launch an app from canvas, this is the error I'm getting. It was working for a day or so, I changed some code in launch that deals with nrps to get the role of the user, I'm getting this error.
The text was updated successfully, but these errors were encountered: