instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.61k stars 2.48k forks source link

External tool launch not including custom parameters requested in ContentItemSelection response #1025

Closed cbothner closed 7 years ago

cbothner commented 7 years ago

I'm building a Tool Provider which provides a content item selection assignment placement. I need to specify some custom parameters to be included with the launch request. Following the IMS information model, I'm sending back a response that looks like this.

lti_message_type='ContentItemSelectionRequest'
lti_version='LTI-1p0'
content_items='{
  "@context": "http://purl.imsglobal.org/ctx/lti/v1/ContentItem",
  "@graph": [
    {
      "@type": "LtiLinkItem",
      "url": "https://localhost:3000/authentication_strategies/auth/lti/callback",
      "mediaType": "application/vnd.ims.lti.v1.ltilink",
      "placementAdvice": {"presentationDocumentTarget": "window"},
      "custom": {"redirect": "https://localhost:3000/cases/tesla-powerwall"}
    }
  ]
}'

I am expecting the LTI launch to include a parameter custom_redirect, but no such parameter is included. Is this the intended functionality? Is there a better way to request the inclusion of custom parameters that vary based on the content item the user selected?

mcwqy9 commented 7 years ago

Great question. We do not currently support custom parameters for content item. This feature is on our roadmap. As a workaround, many developers use GET params in the content item url to distinguish between different content items.

This might look like this

lti_version='LTI-1p0'
content_items='{
  "@context": "http://purl.imsglobal.org/ctx/lti/v1/ContentItem",
  "@graph": [
    {
      "@type": "LtiLinkItem",
      "url": "https://localhost:3000/authentication_strategies/auth/lti/callback?redirect=https%3A%2F%2Flocalhost%3A3000%2Fcases%2Ftesla-powerwall",
      "mediaType": "application/vnd.ims.lti.v1.ltilink",
      "placementAdvice": {"presentationDocumentTarget": "window"}
    }
  ]
}'

If you go down that road, be aware that Canvas will copy the get params into the post body when doing the content item launch. If that is undesirable (for instance it can cause oauth signing issues), consider the oauth_compliant option documented here: https://canvas.instructure.com/doc/api/external_tools.html and here https://canvas.instructure.com/doc/api/file.tools_xml.html under "Launch URL's containing query parameters"

cbothner commented 7 years ago

The oauth signing issues were exactly why I had considered that option (my first choice) unworkable, but I will investigate those resources. Thank you.

SuseeHarini commented 6 years ago

where do we add the files to change the custom parameters of the LTI components?

elliottyates commented 5 years ago

Hello, is this still on the roadmap? I've done some poking in the code but can't unravel where the custom param might be passed along, e.g. in https://github.com/instructure/canvas-lms/blob/609509fa5778f4e698c006ddf4b22e83c91aedba/app/controllers/external_tools_controller.rb#L486. Just wondering if there's been any movement here? Thanks.

RoChess commented 5 years ago

The ability to reference a course content-item ID that Canvas will automatically update when the course gets copied would be extremely useful as well.

karendolan commented 5 years ago

Can anyone provide a link to where this might be on the roadmap?

gkralik commented 4 years ago

This is very unfortunate. The LTI 1.1. Implementation Guide [0] clearly states under 3 Basic Launch Data:

If these custom parameters are included in the LTI link, the TC must include them in the launch data or the TP may fail to function.

When will this finally be fixed?

[0] http://www.imsglobal.org/specs/ltiv1p1p1/implementation-guide

rhodgkins commented 1 year ago

Any update on this - will custom parameters ever be included in the launch request after being specified in a Content-Item?