Moodle Invalid Request
cayhorstmann opened this issue · comments
I am using Moodle 4.1.2 and installed the ltijs-demo-server app (see here for my mods) at https://ltijs-demo-service.onrender.com. When I launch an exercise from Moodle, I get:
Moodle
Invalid request
[More information about this error](https://docs.moodle.org/401/en/error/moodle/invalidrequest)
(That link leads to a nonexistent page.)
How would I go about debugging this?
Expected behavior
Not sure--I have never experienced a successful behavior.
Provider logs
Mar 29 09:16:07 PM 2023-03-29T19:16:07.372Z provider:main Redirecting to platform authentication endpoint
Mar 29 09:16:07 PM 2023-03-29T19:16:07.372Z provider:main Target Link URI: https://ltijs-demo-service.onrender.com
Mar 29 09:16:07 PM 2023-03-29T19:16:07.373Z provider:main Login request:
Mar 29 09:16:07 PM 2023-03-29T19:16:07.373Z provider:main {
Mar 29 09:16:07 PM response_type: 'id_token',
Mar 29 09:16:07 PM response_mode: 'form_post',
Mar 29 09:16:07 PM id_token_signed_response_alg: 'RS256',
Mar 29 09:16:07 PM scope: 'openid',
Mar 29 09:16:07 PM client_id: 'f3zOgmWzJobqEOf',
Mar 29 09:16:07 PM redirect_uri: 'https://ltijs-demo-service.onrender.com',
Mar 29 09:16:07 PM login_hint: '2',
Mar 29 09:16:07 PM nonce: '3xfaq6mjv8ao9oj5k5ewh3t55',
Mar 29 09:16:07 PM prompt: 'none',
Mar 29 09:16:07 PM state: '0750f2fb3de2024ee861020ecb5f39878cddc12252964a32ee',
Mar 29 09:16:07 PM lti_message_hint: '{"cmid":2,"launchid":"ltilaunch1_1386278996"}',
Mar 29 09:16:07 PM lti_deployment_id: '1'
Mar 29 09:16:07 PM }
Ltijs version
- Version 5.7.4
NodeJS version
- 14.17.0 (the default used by render.com, https://render.com/docs/node-version)
Platform used
- Moodle 4.1.2
I think I figured this out when trying to use the Saltire emulator instead. The "redirection URI" is required in Moodle. When I set it to the base URL https://ltijs-demo-service.onrender.com/, I got a response. For the record, here is the complete set of parameters in my Moodle conf.
- Tool name: ltijs Demo Tool Provider
- Tool URL: Base URL of the tool, in my case https://ltijs-demo-service.onrender.com/
- Tool description: Empty
- LTI version: 1.3
- Client ID: (supplied by Moodle, use in call to
lti.registerPlatform
- Public key type: Keyset URL
- Public keyset: (Tool URL)/keys
- Initiate login URL: (Tool URL)/login
- Redirection URI(s): (Tool URL)
- Custom parameters: Empty
- Tool configuration usage: Show as preconfigured tool when adding an external tool
- Default launch container: Embed
- Supports Deep Linking (Content-Item Message): Unchecked
I leave the bug report open so that you can consider adding this information to the documentation.
Hello @cayhorstmann. You are correct, the issue here is the mismatch of the redirect URI and Tool URL. I will be adding this to the documentation during the release of the next major version.