Cvmcosta / ltijs

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

After sucessful login request self hosted canvas is sending request to canvas.docker instead of the hosted URL #189

Closed Soumyaranjanpal closed 1 year ago

Soumyaranjanpal commented 1 year ago

Describe the bug I am able to send login request to my LTI tool, however after receiving response from login request , canvas is sending another request to canvas.docker which is not working as I am accessing canvas through some other host name.

image

await lti.registerPlatform({ url: 'https://canvas.instructure.com', // or url : 'https://canvas.exampledomain.com' (depends on config form Canvas instance) if iss is changed in config/security.yml file! It must be the same as the iss name: 'testsupport1lx', // domain name from canvas instance clientId: '10000000000002', // clientid from the lti plugin which you get inside canvas after installing the plugin authenticationEndpoint: 'http://testsupport1lx:8500/api/lti/authorize_redirect', accesstokenEndpoint: 'http://testsupport1lx:8500/login/oauth2/token', authConfig: { method: 'JWK_SET', key: 'http://testsupport1lx:8500/api/lti/security/jwks' } })

Expected behavior A clear and concise description of what you expected to happen.

Provider logs Copy of the relevant provider logs.

  1. Run code with debug flag: DEBUG=provider:* npm start.
  2. Copy logs relevant to the issue.

Screenshots When it sends login request to LTI tool, it sends with this payload.

image

Then after getting 302 response, it is sending request to my hosted URL (testsupport1lx)

http://testsupport1lx:8500/api/lti/authorize_redirect?response_type=id_token&response_mode=form_post&id_token_signed_response_alg=RS256&scope=openid&client_id=10000000000002&redirect_uri=https://d660-110-227-203-55.ngrok-free.app&login_hint=535fa085f22b4655f48cd5a36a9215f64c062838&nonce=ekccamynuzxp1q5h99szpbnrp&prompt=none&state=18ef3628753e0460553b194504bda4bdbe86e912122d9af564&lti_message_hint=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJpZmllciI6ImY2YzNmNjBjMjljMjEyNjc4OTliZGEzOTQxOGRjM2UxOTZhZThhM2ZiYzA3MTg0NTAwYjRjOGM2ZWNjZDAyY2FiMmMxZTIyMTgxNGNlNWQ0ZTFiN2RkZDk1NjJjMGUwMmExNmFlYThiNjljOGE5NTMwMzEwNjk3ZTA3ZGY1ZTdjIiwiY2FudmFzX2RvbWFpbiI6ImNhbnZhcy5kb2NrZXIiLCJjb250ZXh0X3R5cGUiOiJBY2NvdW50IiwiY29udGV4dF9pZCI6MTAwMDAwMDAwMDAwMDEsImNhbnZhc19sb2NhbGUiOiJlbiIsImV4cCI6MTY4NDg1NjY0NX0.d_c0anluSAIX2haxkpQYC0efb1UNhlpjWbXpir84Q8U

and then after getting 302 response it is again sending request to canvas.docker, which would not work as my canvas is not accessible at canvas.docker host name.

http://canvas.docker:8500/api/lti/authorize?client_id=10000000000002&login_hint=535fa085f22b4655f48cd5a36a9215f64c062838&lti_message_hint=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJpZmllciI6ImY2YzNmNjBjMjljMjEyNjc4OTliZGEzOTQxOGRjM2UxOTZhZThhM2ZiYzA3MTg0NTAwYjRjOGM2ZWNjZDAyY2FiMmMxZTIyMTgxNGNlNWQ0ZTFiN2RkZDk1NjJjMGUwMmExNmFlYThiNjljOGE5NTMwMzEwNjk3ZTA3ZGY1ZTdjIiwiY2FudmFzX2RvbWFpbiI6ImNhbnZhcy5kb2NrZXIiLCJjb250ZXh0X3R5cGUiOiJBY2NvdW50IiwiY29udGV4dF9pZCI6MTAwMDAwMDAwMDAwMDEsImNhbnZhc19sb2NhbGUiOiJlbiIsImV4cCI6MTY4NDg1NjY0NX0.d_c0anluSAIX2haxkpQYC0efb1UNhlpjWbXpir84Q8U&nonce=ekccamynuzxp1q5h99szpbnrp&prompt=none&redirect_uri=https://d660-110-227-203-55.ngrok-free.app&response_mode=form_post&response_type=id_token&scope=openid&state=18ef3628753e0460553b194504bda4bdbe86e912122d9af564

Ltijs version

NodeJS version

Platform used

Additional context @Cvmcosta , do you have any suggestions for me ? That would be really helpful.

xandroxygen commented 1 year ago

The LTI redirect domain is specified using the standard Canvas domain, which pulls from config/domain.yml. You should change the value under

development:
    domain: "canvas.docker"

from canvas.docker to testsupport1lx and then restart your web container. I'm not sure if the port is also needed there, so you may need to play around with it.

Soumyaranjanpal commented 1 year ago

Thank you so much for your help.