Cvmcosta / ltijs

Turn your application into a fully integratable LTI 1.3 tool provider.
https://cvmcosta.github.io/ltijs/
Apache License 2.0
296 stars 65 forks source link

"MISSING_LOGIN_PARAMETERS" error : cookie issue? #206

Open rodolphemarquant opened 1 year ago

rodolphemarquant commented 1 year ago

Hi,

First, thank you for this great library!

I'm having trouble setting it up though (I'm also not a LTI expert...)

I currently have the following error when lauching my app through Moodle: "{"status":400,"error":"Bad Request","details":{"message":"MISSING_LOGIN_PARAMETERS"}}"

Just had it after fixing a few issues with RSA keys and cookies. For the record, i have the following parameters:

    cookies: {
      secure: true, 
      sameSite: 'None' 
    },
    devMode: false 

The login URL and redirect URL are set up on Moodle (https://lti-test.fly.dev/login and https://lti-test.fly.dev respectively)

Console shows me a 400 error with a GET request at https://lti-test.fly.dev/login?response_type=id_token&response_mode=form_post&id_token_signed_response_alg=RS256&scope=openid&client_id=nvnr2QmJ0Re22C2&redirect_uri=https://lti-test.fly.dev&login_hint=74767&nonce=417n22t62t6gcw0yi89fbzmhz&prompt=none&state=3d6f37840c9acf4bc2633db31be6dd00d82664cd392e0edbaf&lti_message_hint=1393372&lti_deployment_id=112

It appears the error is caused by this line: if (!params.iss || !params.login_hint || !params.target_link_uri) When using console.log (and as we can see in the link above), param.iss and params.target_link_uri are indeed undefined.

Any idea what might be causing this?

Thank you!

Ltijs version

NodeJS version

Platform used