drlippman / IMathAS

IMathAS Online Math Assessment
Other
110 stars 98 forks source link

IMathAS and Canvas LTI 1.3 integration using a developer key #423

Closed eth18 closed 1 month ago

eth18 commented 1 month ago

I am struggling to integrate Canvas with IMathAS using a developer key.

When I access the assignment imported from IMathAS in Canvas, I encounter 2 types of errors.

  1. Invalid token error

request type: GET request URL: https://canvas.instructure.com/post_message_forwarding?rev=59677caad5-09bb3c9388a5ba3a&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJwYXJlbnRfZG9tYWluIjoibG1zLnJhdGlvbmFscmVhc29uaW5nLm5ldCJ9.HkrPssJkLlXQPtORZ8hdovfA2g5HdD7T-bA4uEdho55wAfKIgnRhUEBi5UxJrbnuwQEW50q9ELfrpxtZw6h1KA response code: 403 Forbidden response message: Invalid token

  1. Invalid lti_message_hint

request type: GET request URL: https://sso.canvaslms.com/api/lti/authorize_redirect?scope=openid&response_type=id_token&response_mode=form_post&prompt=none&client_id=10000000000024&redirect_uri=https%3A%2F%2Fimathnew.rationalreasoning.net%2Flti%2Flaunch.php&state=state-664bf741e38c09_80019289&nonce=nonce-664bf741e38e08.75797103&login_hint=5576d223a777670d32bac2e720da67f2b881fb88&lti_message_hint=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXJpZmllciI6IjhmMGRmZDJlODVkNzhhN2ExZmNkMjBjYmJiYzhmZGFkYTA3NzMzNmY3MWIwM2NlMmM4YTg0N2JhODhlZGE2NWZjYzIzZTdiN2Y5ZDQ1OWQyNDQ4NzhiYzM3NjgxZDZiODM3MGYwNzcwOWE0NmVlMTM5MzMzNzFhYzZkYmZmZDM4IiwiY2FudmFzX2RvbWFpbiI6Imxtcy5yYXRpb25hbHJlYXNvbmluZy5uZXQiLCJjb250ZXh0X3R5cGUiOiJDb3Vyc2UiLCJjb250ZXh0X2lkIjoxMDAwMDAwMDAwMDAxNywiY2FudmFzX2xvY2FsZSI6ImVuIiwiaW5jbHVkZV9zdG9yYWdlX3RhcmdldCI6dHJ1ZSwiZXhwIjoxNzE2MjU0ODI3fQ.W1rc07U8S4DWI5D0vkqcKUTiqMY58GZ-QnehpUHEybk response code: 400 Bad Request response message: {status: "bad_request", message: "Invalid lti_message_hint"}

image

I've correctly set the Developer Key(LTI key) and the Client ID according to the instructions.

Can you instruct me how to solve these issues?

drlippman commented 1 month ago

Which instructions were you following? I ask because LTI 1.3 doesn't use the language "LTI key" anymore, so I'm wondering if you're mixing 1.1 and 1.3 instructions. IMathAS doesn't use the developer key itself, only the Client ID. The correct instructions for LTI 1.3 are found in Admin->LTI 1.3 Platforms.

One you have the "app" set up in Canvas, if you're using $CFG['LTI']['autoreg'] = true in your config, then you shouldn't have to do anything on the imathas side. If you aren't using that, then make sure you register the Client ID in Admin->LTI 1.3 Platforms.

eth18 commented 1 month ago

I followed the instruction from LTI 1.3 Platforms.

https://imathnew.rationalreasoning.net/lti/admin/platforms.php

To enable LTI 1.3 in a Canvas instance, the site administrator should:

Go to Admin, then Developer Keys, click +Developer Key, then select +LTI Key For Redirect URIs, enter: https://imathnew.rationalreasoning.net/lti/launch.php Set Configure Method: Enter URL Enter JSON URL: https://imathnew.rationalreasoning.net/lti/canvasconfig.php After submitting, turn the State ON Copy the numeric value shown in the Details column. This is the Client ID. (You do not need to click the Show Key button) Go to Admin, then Settings, then Apps, and click View App Configurations Click +App For Configuration Type, select By Client ID. Paste in the Client ID you copied down above, and hit Submit. Now enter the Client ID you copied down above from the Details column.

I registered the Client ID(10000000000024). And there is no $CFG['LTI']['autoreg'] = true in my config.

image

image

IMathAS: https://imathnew.rationalreasoning.net/ Canvas LMS: https://lms.rationalreasoning.net/

drlippman commented 1 month ago

Hmm, that should be all you need. Did you remember to go into the Manage Private Keys and set up at a private key?

Beyond that, not sure what it might be.

eth18 commented 1 month ago

I added a private key.

image

drlippman commented 1 month ago

I don't know what's going on then. FWIW, the lti_message_hint error from your first post isn't an imathas error, which suggests that it's coming from Canvas.

If you want me to dig further, I'd need an account on your Canvas and imathas installs to do some testing from (obviously send by email; don't post in github). If I can't figure out what's going on in ~15min, I may ask you to hire me for support services, as this is now debugging your install, not an issue with the open source repo.

eth18 commented 1 month ago

Thank you.

Can we chat on skype or whatsapp?

On Wed, May 22, 2024 at 2:37 AM David Lippman @.***> wrote:

I don't know what's going on then. FWIW, the lti_message_hint error from your first post isn't an imathas error, which suggests that it's coming from Canvas.

If you want me to dig further, I'd need an account on your Canvas and imathas installs to do some testing from (obviously send by email; don't post in github). If I can't figure out what's going on in ~15min, I may ask you to hire me for support services, as this is now debugging your install, not an issue with the open source repo.

— Reply to this email directly, view it on GitHub https://github.com/drlippman/IMathAS/issues/423#issuecomment-2123118673, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2HIH2BCF45WWXBALIKN2Z3ZDOA3XAVCNFSM6AAAAABIAVKJ5GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRTGEYTQNRXGM . You are receiving this because you authored the thread.Message ID: @.***>

drlippman commented 1 month ago

While I'm willing to answer some basic questions and look into any system issues, any type of support beyond that (particularly any that involves meetings or chat) is outside that scope. I'm willing to provide additional paid support services; if you're interested in that contact me by email.

eth18 commented 1 month ago

I finally solved the issue. There was an issue in the canvas configuration. Thank you @drlippman

drlippman commented 1 month ago

Glad to hear you got it sorted.

Was the issue something others might be likely to run into, and would be worth adding a note in the setup instructions about?