Skip to content

Configure Canvas as LTI 1.3 Platform

Dmitry Viskov edited this page Apr 24, 2020 · 12 revisions

Consider game example as LTI 1.3 Tool.

  1. Canvas was installed locally in Docker using default manual:

https://github.com/instructure/canvas-lms/wiki/Quick-Start#automated-setup

  1. Enable LTI 1.3 in "Settings / Feature Options" (in the new test org):

  1. Go to the “Developer Keys” section and create new LTI Key:

Redirect URIs: http://127.0.0.1:9001/launch/
Target Link URI: http://127.0.0.1:9001/launch/
OpenID Connect Initiation Url: http://127.0.0.1:9001/login/
JWK Method: Public JWK (you may use value from example: https://github.com/dmitry-viskov/pylti1.3-django-example/blob/master/configs/public.jwk.json)
LTI Advantage Services: Enable all toggles
Placements: Choose "Assignment Selection"
Assignment Selection / Target Link URI: http://127.0.0.1:9001/launch/
Assignment Selection / Select Message Type: LtiDeepLinkingRequest

Note: You may generate other jwk and public+private keys using instruction: https://github.com/dmitry-viskov/pylti1.3/wiki/How-to-generate-JWT-RS256-key-and-JWKS . Also you may provide JWKS using Tool Config API:

from urllib.parse import unquote
from django.http import JsonResponse
from pylti1p3.tool_config import ToolConfJsonFile

def get_jwks(request):
    iss = request.GET.get('iss')
    if not iss:
        return JsonResponse({'error': "iss was not passed"})
    iss = unquote(iss)
    tool_conf = ToolConfJsonFile('../path/to/json')
    data = tool_conf.get_jwks(iss)
    return JsonResponse(data, safe=False)
  1. Change "State" from OFF to ON for the new created key

  2. Create new External App: "Settings -> Apps -> +App"
    Choose "Configuration Type: by ClientID"
    Insert "ClientID" from the created Key (value from Details column)

  1. Update settings on the python side: https://github.com/dmitry-viskov/pylti1.3-django-example/blob/master/configs/game.json
"https://canvas.instructure.com": [{
    "default": true,

    // from Canvas: Developer Keys -> value from Details column
    "client_id": "10000000000004",

    // static URL
    "auth_login_url": "http://canvas.docker/api/lti/authorize_redirect",

    // static URL
    "auth_token_url": "http://canvas.docker/login/oauth2/token",  

    // static URL to get Platform's public key
    "key_set_url": "http://canvas.docker/api/lti/security/jwks",

    // instead of fetch key_set_url every launch we may just insert static JWKS here
    "key_set": null,

    // Tool's private key 
    "private_key_file": "private.key",

    // Tool's public key 
    "public_key_file": "public.key",

    // copy deployment ID from the Canvas created app (screenshot below)
    "deployment_ids": ["6:8865aa05b4b79b64a91a86042e43af5ea8ae79eb"]
}]

  1. On Canvas side go to Course Assignments and create new External Tool using Launch URL (http://127.0.0.1:9001/launch/):

  1. To test Deep Linking don't enter anything. Just push "Find" button and choose your Tool from list. You will see modal popup with difficulty options:

Clone this wiki locally