Skip to content

Add an LTI 1.3 debug log in the case that the JWT fails to decode on a launch request. (hotfix version) - #2787

Merged
Alex-Jordan merged 2 commits into
openwebwork:mainfrom
drgrice1:lti-1.3-debug-hotfix
Aug 21, 2025
Merged

Add an LTI 1.3 debug log in the case that the JWT fails to decode on a launch request. (hotfix version)#2787
Alex-Jordan merged 2 commits into
openwebwork:mainfrom
drgrice1:lti-1.3-debug-hotfix

Conversation

@drgrice1

@drgrice1 drgrice1 commented Aug 14, 2025

Copy link
Copy Markdown
Member

In this case the LTIAuthenError stash value is set, but that error is never shown anywhere because the course ID was not determined and the authen verify method is never called. So this information goes to the abyss and the debug log abrubtly terminates (see https://forums.openwebwork.org/mod/forum/discuss.php?d=8749 for what this debug log looks like). So this pull request always debug logs it in this case. There is not enough information to even determine if LTI debugging is enabled for the course (which the request failed to determine), so it has to be the more general debug logging facility. This may help in resolving the issues that are occuring with the cases such as those in the above mentioned forum post and https://forums.openwebwork.org/mod/forum/discuss.php?d=8738#p22228.

Edit:

This also now adds a JWTLeeway for LTI 1.3 JWT validation. This is the maximum number of seconds that the exp and iat values in the JWT sent with a launch request are allowed to be in the future relative to the current time on the webwork2 server. The Crypt::JWT module by default uses a value of 0 for this, meaning that the iat and exp values in the token must be before the current time on the webwork2 server.

This may be why many are experiencing issues with JWT tokens failing to validate, and is due to the clock on the LMS server being ahead of the clock on the webwork2 server. Generally such issues can be resolved by synchronizing clocks, but in some cases a small leeway may be needed.

@drgrice1
drgrice1 force-pushed the lti-1.3-debug-hotfix branch 2 times, most recently from 410055d to 75b5bd7 Compare August 15, 2025 12:47
@drgrice1
drgrice1 requested review from Alex-Jordan and dlglin August 20, 2025 02:41
…a launch request.

In this case the LTIAuthenError stash value is set, but that error is
never shown anywhere because the course ID was not determined and the
authen verify method is never called.  So this information goes to the
abyss and the debug log abrubtly terminates (see
https://forums.openwebwork.org/mod/forum/discuss.php?d=8749 for what
this debug log looks like).  So this pull request always debug logs it
in this case.  There is not enough information to even determine if LTI
debugging is enabled for the course (which the request failed to
determine), so it has to be the more general debug logging facility.
This may help in resolving the issues that are occuring with the cases
such as those in the above mentioned forum post and
https://forums.openwebwork.org/mod/forum/discuss.php?d=8738#p22228.
This is the maximum number of seconds that exp and iat values in the JWT
sent with a launch request are allowed to be in the future relative to
the current time on the webwork2 server.  The Crypt::JWT module by
default uses a value of 0 for this, meaning that the iat and exp values
in the token must be before the current time on the webwork2 server.

This may be why many are experiencing issues with JWT tokens failing to
validate, and is due to the clock on the LMS server being ahead of the
clock on the webwork2 server. Generally such issues can be resolved by
synchronizing clocks, but in some cases a small leeway may be needed.
@drgrice1
drgrice1 force-pushed the lti-1.3-debug-hotfix branch from 75b5bd7 to 0c11e3d Compare August 20, 2025 19:27
@Alex-Jordan
Alex-Jordan merged commit 3f8d5a6 into openwebwork:main Aug 21, 2025
2 checks passed
@drgrice1
drgrice1 deleted the lti-1.3-debug-hotfix branch August 21, 2025 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants