-
Notifications
You must be signed in to change notification settings - Fork 67
Configure Canvas as LTI 1.3 Platform
Consider game example as LTI 1.3 Tool.
- Canvas was installed locally in Docker using default manual:
https://github.com/instructure/canvas-lms/wiki/Quick-Start#automated-setup
- Enable LTI 1.3 in "Settings / Feature Options" (in the new test org):
- 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) or Public JWK URL: http://127.0.0.1:9001/jwks/
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 through URL using Tool Config API:
from django.http import JsonResponse
from pylti1p3.registration import Registration
def get_jwk_from_public_key(key_name):
f = open(key_path, 'r')
key_content = f.read()
jwk = Registration.get_jwk(key_content)
f.close()
return jwk
def get_jwks(request):
result_keys = []
public_keys = ['public.key', 'public2.key', 'public3.key']
for key in public_keys:
jwk = get_jwk_from_public_key(key)
result_keys.append(jwk)
return JsonResponse({'keys': result_keys}, safe=False)
-
Change "State" from OFF to ON for the new created key
-
Create new External App: "Settings -> Apps -> +App"
Choose "Configuration Type: by ClientID"
Insert "ClientID" from the created Key (value from Details column)
- 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"]
}]
- On Canvas side go to Course Assignments and create new External Tool using Launch URL (http://127.0.0.1:9001/launch/):
- 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: