lduarte1991 / hxat

Contains the currently-in-development project by HarvardX to bring the annotation tool currently living in the edX platform to a more accessible LTI implementation.
12 stars 7 forks source link

Handle requests without `tool_consumer_instance_guid` #95

Closed clemente closed 4 years ago

clemente commented 6 years ago

This code accesses tool_consumer_instance_guid, which may not be present in the request, and it fails:

[…]
File "/srv/hxat/hx_lti_initializer/views.py", line 68, in launch_lti
  tool_consumer_instance_guid = request.LTI['launch_params']['tool_consumer_instance_guid']
KeyError: 'tool_consumer_instance_guid'

It seems a workaround is to add ["tool_consumer_instance_guid=<unique_identifier>"] to the custom parameters of the LTI block, but maybe the code must handle the case where the parameter isn't there. Or document adding thet custom parameter to the LTI block.

clemente commented 6 years ago

@lduarte1991 FYI we had to add this custom parameter in our setup, could you confirm that it's fine?

clemente commented 6 years ago

tool_consumer_instance_guid seems recommended though not required, according to https://www.imsglobal.org/specs/ltiv1p0/implementation-guide

clemente commented 6 years ago

Ah, I didn't notice the special case for HARVARDX organization. To make it easier for other users, you could make the default (without that LTI parameter) be included in that branch of the if, or at least provide a descriptive exception instead of the KeyError when that LTI parameter isn't present.