Configuring
Manually Configuring LTI Advantage Tools
For versions of LTI previous to LTI 1.3, please refer to the older documentation
For a successful launch to occur, LTI Advantage Tools require configuration on both Canvas and inside the tool:
But first, the importance of each configuration setting can only be understood with a basic understanding of how an LTI launch occurs.
Overview of an LTI Launch
The IMS Security Framework uses an Open ID Connect (OIDC) third-party flow. You'll want to read these specifications in detail, but the following is a Canvas-specific summary:
Step 1: Login Initiation
Canvas initiates a login request to the oidc_initiation_url
that is configured on the LTI developer key. This requests contains an issuer identifier (iss
) to recognize Canvas is launching the tool. As the issuer, Instructure-hosted Canvas instances all use the following, regardless of the specific account domain(s) that the tool was launched from:
https://canvas.instructure.com (Production environment launches)
https://canvas.beta.instructure.com (Beta environment launches)
https://canvas.test.instructure.com (Test environment launches)
The request also includes a login_hint
that is passed in the next step. Last, the request include the target_link_uri
that has been configured on the Developer key; this is later used by the tool as a recommended final redirect.
Parameter | Description |
---|---|
iss | The issuer, as described above. |
login_hint | Opaque value that must be passed back to Canvas in the next step. |
target_link_uri | The recommended final redirect for the tool; not required. |
client_id | The OAuth2 client id, or Developer Key id, for convenience. |
deployment_id | Unique identifier for the specific deployment of this tool, for convenience. |
canvas_region | For hosted Canvas, the AWS region (e.g. us-east-1) in which the institution that provided this token resides. For local or open source Canvas, this will have a value of "unknown". This field is safe to ignore. This can be used for tools that are hosted in multiple regions to launch to one url and redirect to the correct region. |
canvas_environment | For hosted Canvas, the environment (e.g. "production", "beta", or "test") from which the tool is being launched. For local or open source Canvas, this will have a value of "production". This field is safe to ignore. Tools can use this to redirect to beta- or test-specific instances of their tool on launch. This is in place of the LTI 1.1 `environments` tool config option, which is not recognized for 1.3 tools. |
Step 1.5: Optional Tool-to-tool Redirect
There are situations where a tool wants to use a region-specific or environment-specific instance of itself to respond to the LTI launch, like keeping traffic within the same region as the instance of Canvas, or using a different domain or even launch URL when launched from beta Canvas vs normal production.
Tools can use the canvas_region
or canvas_environment
parameters specified above, or even the Canvas URL from the request's referrer, to decide if they want to redirect.
Example of redirecting to a different domain based on region and environment:
Login request is made to the tool's OIDC initiation URL,
mytool.net/login
, and containscanvas_region: us-west-2, canvas_environment: beta
.The tool redirects to
beta-pdx.mytool.net/login
, forwarding all of the request parameters.The beta-pdx instance of the tool responds by continuing on to Step 2 below.
Example of redirecting to a different launch URL based on environment:
Login request is made to the tool's OIDC initiation URL,
mytool.net/login
, and containscanvas_environment: beta, target_link_uri: mytool.net/launch
.The tool continues on to Step 2 below, but sends
redirect_uri: mytool.net/beta_launch
instead of using the target_link_uri.
Tools that wish to utilize this redirect need to make sure that all possible initiation URLs, whether the domains or paths vary, are added to the redirect URIs list on their corresponding Developer Key, so that the auth request in Step 2 succeeds.
Tools that utilize different instances for beta and test must also make sure that they are storing the correct corresponding values for Canvas URLS like the OIDC Auth URL, JWKs URL, and the Issuer/iss
, and that they use the beta or test versions of all of those URLs when the tool is launched from beta or test Canvas.
Using the oidc_initiation_urls
option described in the JSON tool config can also produce a similar outcome while removing the need for the tool to perform an internal redirect.
Step 2: Authentication Request
To complete authentication, tools are expected to send back an authentication request to an "OIDC Authorization end-point". This can be a GET or POST, however, this request needs to be a redirect in the user’s browser and not made server to server as we need to validate the current user's session data. For cloud-hosted Canvas, regardless of the domain used by the client, the endpoint is always:
https://sso.canvaslms.com/api/lti/authorize_redirect
(if launched from a production environment)https://sso.beta.canvaslms.com/api/lti/authorize_redirect
(if launched from a beta environment)https://sso.test.canvaslms.com/api/lti/authorize_redirect
(if launched from a test environment)The domain for this endpoint used to be
https://canvas.instructure.com
. The impetus for this change and other exact details are described in this Canvas Community article. Tools wishing to implement the Platform Storage spec are required to use the new domain for this endpoint, and all other tools should update this endpoint in their configuration store as soon as possible. This change will eventually be enforced, but for now is not a breaking change - the old domain will continue to work. Any questions or issues are either addressed in the linked article or can be filed as a standard support/partner support case, referencing the OIDC Auth endpoint change.
Among the required variables the request should include:
a
redirect_uri
, which must match at least one configured on the developer key.a
client_id
that matches the developer key. This must be registered in the tool before the launch occurs.the same
login_hint
that Canvas sent in Step 1.a
state
parameter the tool will use to validate the request in Step 4.
Step 3: Authentication Response (LTI Launch)
Canvas will use the client_id
to lookup which developer key to use and then check the redirect_uri
that was sent in the previous step and ensure that there is a exact-matching redirect_uri
on the developer key. Canvas then sends its authentication response to the redirect_uri
that the tool provided in Step 2. The request will include an id_token
which is a signed JWT containing the LTI payload (user identifiers, course contextual data, custom data, etc.). Tools must validate the request is actually coming from Canvas using Canvas' public JWKs.
Step 4: Resource Display
The tool then validates the state
parameter matches the one sent in Step 2 and redirects the User Agent to the target_link_uri
that was sent in Step 1 (or some other location of its choice) to display the final resource. This redirect occurs in an iframe unless the tool is configured otherwise.
Launching without Cookies
Safari blocking cookies inside 3rd-party iframes made it necessary to create a workaround for storing the state
property between the login and launch requests, to prevent MITM attacks. The newly finalized LTI Platform Storage spec provides a way for tools that are launching in Safari or another situation where cookies can't get set to still store data across requests in a secure fashion. Tools can send window.postMessage
s to Canvas asking it to store and retrieve arbitrary data, which acts as a cookie-like proxy.
The LTI Platform Storage spec includes an implementation guide which needs to be the primary resource for implementing this, though a brief usage overview is included below.
Support for this API is determined by either:
the presence of the
lti_storage_target
as an extra body parameter in both the login (Step 1) and launch (Step 3) requests, ora response postMessage to the
lti.capabilities
postMessage that contains thelti.get_data
andlti.put_data
subjects.
If the lti_storage_target
parameter is absent, or the tool doesn't receive a response postMessage for lti.capabilities
, then the tool should not attempt to use this API and should fall back to cookies to verify the launch state
parameter.
When the tool sees either of the above signals that Canvas supports this API, then:
In Step 2, instead of storing the
state
parameter in a cookie the tool should store it in Canvas's LTI Platform Storage using thelti.put_data
postMessage. It's recommended that the key include the value (eg key: "state-1234", value: "1234") to avoid any collisions during multiple launches, and to make recovering the value easy.In Step 4, instead of comparing the
state
parameter to the stored value in the cookie, the tool should retrieve it using thelti.get_data
postMessage. Since this comparison has to happen in Javascript instead of on the server, the tool should render something, then check these values. If the values don't match, the tool can then log the user out or render an error.
According to the spec, the target origin for these postMessages must be the OIDC Auth domain (e.g. https://sso.canvaslms.com
). Since every institution's domain varies, Canvas renders a frame at this domain that will respond to postMessages, and the name of this frame is supplied in the lti_storage_target
parameter, provided as a body parameter in both login and launch requests. Tools should send their lti.put_data
and lti.get_data
postMessages to that frame, but can continue to send all other postMessage types to the parent window.
The LTI Platform Storage spec docs:
Configuring Canvas in the Tool
Tools will need to be aware of some Canvas-specific settings in order to accept a launch from Canvas and use the LTI Advantage Services:
Canvas Public JWKs: When the tool receives the authentication response (Step 3), tools must validate that the request is actually coming from Canvas. Canvas' public keys are environment-specific, but not domain-specific (the same key set can be used across all client accounts):
Production:
https://sso.canvaslms.com/api/lti/security/jwks
Beta:
https://sso.beta.canvaslms.com/api/lti/security/jwks
Test:
https://sso.test.canvaslms.com/api/lti/security/jwks
Note: The domain for this endpoint used to be
https://canvas.instructure.com
. The impetus for this change and other exact details are described in this Canvas Community article. Tools wishing to implement the Platform Storage spec are required to use the new domain for this endpoint, and all other tools should update this endpoint in their configuration store as soon as possible. This change will eventually be enforced, but for now is not a breaking change - the old domain will continue to work. Any questions or issues are either addressed in the linked article or can be filed as a standard support/partner support case, referencing the OIDC Auth endpoint change.
Client ID: The
client_id
of the Developer Key that's been configured in Canvas. Your tool will need to use this in the authentication response to Canvas (Step 2) and it is also used during the Client Credentials Grant to access LTI Advantage Services.Deployment ID: The
deployment_id
can be optionally configured in the tool. A single developer key may have many deployments, so the deployment ID can be used to identify which deployment is being launched. For more, refer to the LTI 1.3 core specification, section 4.1.2. Thedeployment_id
in Canvas is exposed after a tool has been deployed using theclient_id
.
Configuring the Tool in Canvas
With LTI Advantage, Canvas moved to using Developer Keys to store tool configuration information. After a developer key is created and enabled, tools can be deployed to accounts/sub-accounts or courses.
Developer Keys allow tools to set the required parameters to complete the OpenID Connect Launch Flow, leverage LTI Advantage Services, and configure other important settings.
With guidance from the tool developer, developer keys settings can be manually entered by Account Admins. Tools providers can also supply Account Admins with a JSON configuration or configuration URL containing the settings the tool provider has verified to work.
In the manual case, since many of the extensions listed here require more than a few lines of configuration, there is not currently an interface for every extension to be manually configured. Instead, we encourage tool providers to expose a set of URL endpoints that return working configuration options for their tool services.
If providing a URL configuration endpoint is not an option, you can also provide your users with raw JSON that they can paste in for configuration.
Anatomy of a JSON configuration
In this section, an example JSON configuration is shown followed by a table describing the relevance of each field.
NOTE: Certain placement-specific settings may not be described here. Some examples of JSON configuration snippets and placement-specific settings are also found in the placements sub-menu in the left-navigation of this documentation.
Parameter | Type | Description | |
---|---|---|---|
title | Required | string | The default name of the tool in the app index. This value is also displayed if no "text" field is provided within extension settings or placements. |
description | Required | string | A description of the tool. |
oidc_initiation_url | Required | string | The login initiation url that Canvas should redirect the User Agent to. |
oidc_initiation_urls | JSON object | Optional region-specific login initiation urls that Canvas should redirect the User Agent to. Each institution's Canvas install lives in a particular AWS region, typically one close to the institution's physical region. If ths AWS region is listed as a key in this object, the URL in the value will override the default `oidc_initiation_url`. As of 2023, the regions used by Canvas are: us-east-1, us-west-2, ca-central-1, eu-west-1, eu-central-1, ap-southeast-1, ap-southeast-2. | |
target_link_uri | Required | string | The target_link_uri that Canvas should pass in the to the login initiation endpoint. This allows tools to determine which redirect_uri to pass Canvas in the authorization redirect request and should be verified during the final launch. This can be set at the tool-level, or within the "placements" JSON object for placement-specific target_link_uri's. |
scopes | string array | The comma separated list of scopes to be allowed when using the client_credentials grant to access LTI services. Allowed values: | |
extensions | array of JSON objects | The set of Canvas extensions, including placements, that the tool should use. | |
domain | string | The domain Canvas should use to match clicked LTI links against. This is recommended if deep linking is used. | |
tool_id | string | Allows tools to set a unique identifier for the tool. | |
platform | string | The LMS platform that the extensions belong to. This should always be set to "canvas.instructure.com" for cloud-hosted Canvas. | |
privacy_level | Required | string | What level of user information to send to the external tool. Setting this to "name_only" will include fields that contain the user's name and sourcedid in the launch claims. "email_only" will include only the user's email. "public" includes all fields from "name_only", "email_only", and fields like the user's picture. "anonymous" will not include any of these fields. Note that the "sub" claim containing the user's ID is always included. Allowed values: |
settings | JSON object | The set of platform-specific settings to be used. | |
text | string | The default text to show for this tool. Can be set within "settings" for the tool-level display text, or within "placements" object for placement-specific display text. | |
labels | JSON object | An object for translations of the "text", used to support internationalization (i18n) / localization (l10n). If the user's Canvas interface is set to one of the languages listed, the tool will display the translated text in place of the value in the "text" field. More specific locales ("en-AU") are preferred over less specific ones ("en"). Can be set within "settings" or individual placements. | |
icon_url | string | The url of the icon to show for this tool. Can be set within the "settings" object for tool-level icons, or in the "placement" object for placement-specific icons. NOTE: Not all placements display an icon. | |
selection_height | string | The display height of the iframe. This may be ignored or overridden for some LTI placements due to other UI requirements set by Canvas. Tools are advised to experiment with this setting to see what makes the most sense for their application. | |
selection_width | string | The display width of the iframe. This may be ignored or overridden for some LTI placements due to other UI requirements set by Canvas. Tools are advised to experiment with this setting to see what makes the most sense for their application. | |
enabled | boolean | Optional, defaults to `true`. Set within the "placements" object to to determine if the placement is enabled. | |
message_type | string | The IMS message type to be sent in the launch. This is set at the placement level. Not all placements support both message_types. Allowed values: | |
required_permissions | string | Limits tool visibility to users with certain permissions, as defined on the user's built-in Canvas user roles AND the custom roles that you may have created in Canvas. This is a comma-separated string of one or more required permissions, such as | |
environments | Ignored | JSON object | LTI 1.1 tools support environment-specific domains and launch urls, used for launching from beta or test instances of Canvas. This config option is not supported for LTI 1.3. Tools instead should use the |
public_jwk | required, see notes | JSON object | Required if public_jwk_url is omitted. The tools public key to be used during the client_credentials grant for accessing LTI Advantage services. |
public_jwk_url | required, see notes | string | Required if public_jwk is omitted. The tools public key uri to be used during the client_credentials grant for accessing LTI Advantage services. |
custom_fields | JSON object | Custom fields that will be sent to the tool consumer; can be set at the tool-level or within the "placement" JSON object for placement-specific custom fields. |
© Instructure, Inc. Generated on Wed Nov 6 14:19:59 2024 This documentation is generated directly from the Canvas LMS source code, available on Github.
Last updated