Skip to content

tl-its-umich-edu/canvas-lti-redirect-tool

Repository files navigation

canvas-lti-redirect-tool

This is Canvas LTI redirect tool which use the CAI developed LTI library

Prerequisites

To follow the instructions below, you will at minimum need the following:

  1. Docker Desktop.
  2. Git

Installation and Setup

  1. You need to web Proxy like Loophole or ngrok to run the application. Loophole offers custom domain

    loophole http 6000 --hostname <your-host>
  2. Copy the .env.sample file as .env.

    cp .env.sample .env
    
  3. Examine the .env file. It will have the suggested default environment variable settings, mostly just MySQL information as well as locations of other configuration files.

  4. Edit .env, referring to the web proxy started above using loophole or ngrok, update the values for the settings…

    • ALLOWED_HOSTS — Add the hostname of the proxy.
    • CSRF_TRUSTED_ORIGINS — Add the base URL of the proxy.
  5. Start the Docker build process (this will take some time).

    docker compose build
  6. Start up the web server and database containers.

    docker compose up
  7. generate Django secret using below command

python manage.py shell -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"

LTI install

  1. Need to run this command once docker container is up in order for LTI to work. This is important step otherwise the LTI tool launch won't happen
 docker compose exec -it web ./manage.py rotate_keys 
  1. Create superuser using
    docker compose exec -it web ./manage.py createsuperuser
    
    need to run a proxy like loophole or ngrok for LTI installation and login with that user. Go to https://{app-hostname}/admin/.
  2. Go to Canvas instance, choose Developer Keys in admin site
  3. Add LTI Key
  4. Choose Paste JSON method
  5. Goto LTIRegistration to configure an LTI tool from admin console. This will create the uuid automatically. Hold on to that value and update the OpenID Connect Initiation Url in the LTI tool registration from Canvas with this id. for Eg: https://clrt-local.loophole.site/init/0b54a91b-cac6-4c96-ba1e/
  6. use the setup/lti-config.json for registing the LTI tool. Replace all the {app-hostname} with your web proxy url and uuid:lti-registration with UUID value from LTI tool registration.
  7. Configure the LTI configuration from CLRT tool going to admin again. Give the following value. Note: <canvas-lti-platform>: ['canvas.test', 'canvas.beta', 'canvas'] and : [sso.test.canvaslms.com, sso.beta.canvaslms.com, sso.canvaslms.com]. Documentation Domain URL changes
    1. Name: any name
    2. Issuer: https://.instructure.com
    3. Client ID: (get this from Platform)
    4. Auth URL: https://.instructure.com/api/lti/authorize_redirect
    5. Access token URL: https://.instructure.com/login/oauth2/token
    6. Keyset URL: https://.instructure.com/api/lti/security/jwks
    7. DEPLOYMENT ID: get this as it is described the step 7 and paste
  8. Save
  9. Go to the Canvas(platform) add the LTI tool at account/course level and copy the deployment id by clicking the setting button next to it.

Make a user superuser

  1. go to the auth_user table and set is_superuser and is_staff to 1 or true this will give the logged user access to admin interface
  2. In order to access the admin interface for to https:///admin