|
| 1 | +The lti django app contains all of EconPractice's LTI-related |
| 2 | +code. |
| 3 | + |
| 4 | +Canvas allows LTI integration in a few different ways. Within a |
| 5 | +course, you can select Settings, and then the Apps tab. From here, you |
| 6 | +can add an LTI app using a number of different methods, i.e.: Manual |
| 7 | +Entry, By URL, Paste XML, By Client ID, or By LTI 2 Registration URL. |
| 8 | +Most of these methods actually refer to the deprecated LTI 1.1 |
| 9 | +protocol (keep in mind LTI 2 is also deprecated, and is actually older |
| 10 | +than LTI 1.3). The most reliable method I've found here is to use "By |
| 11 | +Client ID". |
| 12 | + |
| 13 | +For more context on all this, I have found |
| 14 | +[Canvas's LTI documentation](https://canvas.instructure.com/doc/api/file.tools_intro.html) |
| 15 | +to be pretty straightforward and understandable as an intro to LTI, |
| 16 | +in comparison to the [LTI 1.3 standard](https://www.imsglobal.org/spec/lti/v1p3/) |
| 17 | +itself. |
| 18 | + |
| 19 | +## EconPractice / Canvas integration (LTI 1.3) |
| 20 | + |
| 21 | +To integrate EconPractice with Canvas, first we create an LTI |
| 22 | +Registration in EconPractice's admin page: |
| 23 | +* `https://<econpractice hostname>/admin/lti_tool/ltiregistration/` |
| 24 | + |
| 25 | +1. Click "Add LTI Registration" |
| 26 | +2. Name: Canvas instance hostname, e.g. `canvas.ctl.columbia.edu` |
| 27 | +3. UUID: This is filled in automatically |
| 28 | +4. Issuer: `https://<canvas instance hostname>` |
| 29 | +5. Client ID: Set to 1 for now, this will be updated later |
| 30 | +6. Auth URL: `https://<canvas instance hostname>/api/lti/authorize_redirect` |
| 31 | +7. Access token URL: `https://<canvas instance hostname>/login/oauth2/auth` |
| 32 | +8. Keyset URL: `https://<canvas instance hostname>/api/lti/security/jwks` |
| 33 | + |
| 34 | +Then, in Canvas, navigate to Admin -> CTL -> Developer Keys. |
| 35 | + |
| 36 | +1. Click the blue "+ Developer Key" button and select "LTI Key". ("API |
| 37 | + Key" here refers to Canvas's custom API which we don't have special |
| 38 | + integration for, so we definitely want to choose "LTI Key" here.) |
| 39 | +2. Select Method -> Enter URL |
| 40 | +3. Enter the URL: `https://<your econpractice hostname>/lti/<registration uuid>/config.json` |
| 41 | +4. Fill in the Key Name as EconPractice, as well as an admin email for |
| 42 | + Owner Email. |
| 43 | +5. Under Redirect URIs, add: `https://<your econpractice hostname>/lti/launch/` |
| 44 | +6. Click Save |
| 45 | +7. Under "Details", you will see an ID like "10000000000018". This is the "Client ID". |
| 46 | + Go back to the LTI Registration in EconPractice and update the Client ID with this |
| 47 | + value. Without doing this, the LTI launch will raise: |
| 48 | + `OIDCException: Could not find registration details` |
| 49 | + |
| 50 | +Once the LTI Registration and the Developer Key are in place, you can |
| 51 | +add this LTI App to a course. |
| 52 | + |
| 53 | +1. Navigate to a course in Canvas, and go to Settings. |
| 54 | +2. Click the Apps tab, and click the "+ App" button to add a new app. |
| 55 | +3. Under Configuration Type, select "By Client ID". |
| 56 | +4. For the Client ID, input the ID of the Developer Key you created, which |
| 57 | + should look something like "10000000000018". |
| 58 | +5. Click Submit. |
| 59 | + |
| 60 | +The EconPractice LTI app should now be installed in this course. You can |
| 61 | +click on the gear icon, then Placements to see app placements. The |
| 62 | +"Course Navigation" placement should be active, and this is adds a |
| 63 | +"EconPractice" menu item in the course sidebar. Sometimes the Placements |
| 64 | +aren't automatically configured on the first try. If you don't see the |
| 65 | +EconPractice menu item on the left, go back to the Developer Key and see |
| 66 | +how things are configured, and save this again if necessary. This should |
| 67 | +be smoothed over once we migrate to the new "LTI Dynamic Registration", |
| 68 | +which Canvas only recently added support for. See: |
| 69 | +https://github.com/academic-innovation/django-lti/pull/135#issuecomment-2644062255 |
| 70 | + |
| 71 | +Now, there is still one more thing to do: the LTI Deployment must be made |
| 72 | +"active". To do this: |
| 73 | + |
| 74 | +1. Select the EconPractice menu item in the course. You should receive the |
| 75 | + error message "This deployment is not active". This is an expected error |
| 76 | + message that comes from django-lti. |
| 77 | +2. Navigate to your LTI Registration management admin screen in EconPractice, |
| 78 | + and look under LTI Deployments. You should see one populated now, and |
| 79 | + simply select the "Is Active" checkbox, and Save. |
| 80 | + |
| 81 | +Now, *finally*, the tool should successfully launch within Canvas. |
| 82 | + |
| 83 | +## Notes about LTI libraries |
| 84 | + |
| 85 | +Python support for LTI 1.3 is not in the most cohesive state right now, as |
| 86 | +different people have contributed their efforts at different times and in |
| 87 | +different places. That said, it has been possible to get things working |
| 88 | +building off what open source libraries have been built. |
| 89 | + |
| 90 | +[pylti1.3](https://github.com/dmitry-viskov/pylti1.3) is a good base to build |
| 91 | +off of. And although it is not actively maintained, it is entirely possible to |
| 92 | +override anything we need to, when necessary. |
| 93 | + |
| 94 | +A lot of the functionality in pylti1.3 is pretty low-level though, and a lot |
| 95 | +of the LTI transactions and setup can be pre-configured when working with |
| 96 | +Django. Fortunately a lot of this work has been done by the |
| 97 | +[django-lti](https://github.com/academic-innovation/django-lti) library, which |
| 98 | +builds off of pylti1.3. There is some overlap in functionality here, as pylti1.3 |
| 99 | +also contains some Django-specific code. But the django-lti library fills in the |
| 100 | +gaps, and is under active development and open to suggestions that we might find |
| 101 | +helpful as we work deeper with LTI 1.3 integration. |
0 commit comments