Passing Parameters to LTI Launch URL

Jump to solution
manuelgarciaph
Community Participant

We built an application that is hosted on our private server. As of this point, we were able to embed the app using LTI and iframes. The next phase of our application is to dynamically changed the app content based on who's logged in and what course he/she is currently in.

The question is, is it possible to pass parameters (such as course id and student id) to the LTI Launch URL? Instead of "http://app.com/, it would be something like "http://app.com/?course=NNNNN&student=NNNNN" where both course and student values are predetermined by canvas.

That way, we could extract those values via a get parameter and pass it to our application before loading the app in the canvas.

1 Solution
James
Community Champion

manuelgarciaph 

Look at the LTI Variable Substitutions documentation page.

When you add a custom field in the LTI configuration, it gets sent along with the API request.

  • Canvas.course.id will return the course ID
  • Canvas.user.id or user.id will return the user ID. If, for some reason, you need the global ID across all Canvas shards, there is also a Canvas.root_account.global_id and Canvas.user.globalId.

In the custom fields, the left side is the name you want to use and the right side is the variable substitution, prefaced with a $. For example: course.id=$Canvas.course.id

In the LTI launch request, the fields names (left side of assignment in the custom fields) are prefixed with custom_ and periods are changed to underscores: course.id would become custom_course_id.

View solution in original post