Using the LTI Consumer XBlock in Maple

Hi all!

I am trying to set up the LTI Consumer XBlock in Maple with tutor and running into some issues. I am following the steps in the README to test the LTI 1.1 Provider. I’ve added lti_consumer to the advanced module list and test:test:secret to the LTI Passports list, I added a LTI Consumer block to a unit page with LTI ID: "test" and LTI URL: "https://lti.tools/saltire/tp" and when I save/publish/preview/view live I get an error (from the cms container):

2022-05-10 14:03:59,030 ERROR 8 [django.request] [user 33] [ip 10.0.0.19] log.py:224 - Internal Server Error: /preview/xblock/block-v1:cc+lti+dev+type@lti_consumer+block@068702217e6d4707bc33b11a25b9df81/handler/lti_launch_handler
Traceback (most recent call last):
  File "/openedx/venv/lib/python3.8/site-packages/lti_consumer/lti_1p1/oauth.py", line 53, in get_oauth_request_signature
    _, headers, _ = client.sign(
  File "/openedx/venv/lib/python3.8/site-packages/oauthlib/oauth1/rfc5849/__init__.py", line 314, in sign
    "Headers indicate a formencoded body but body was not decodable.")
  File "/openedx/venv/lib/python3.8/site-packages/oauthlib/oauth1/rfc5849/__init__.py", line 136, in get_oauth_signature
    self.encoding = encode(encoding)
  File "/openedx/venv/lib/python3.8/site-packages/oauthlib/oauth1/rfc5849/signature.py", line 143, in normalize_base_string_uri
    raise ValueError('missing scheme')
ValueError: uri must include a scheme and netloc

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/pyenv/versions/3.8.12/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/openedx/venv/lib/python3.8/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/django/views/decorators/clickjacking.py", line 50, in wrapped_view
    resp = view_func(*args, **kwargs)
  File "/openedx/edx-platform/./cms/djangoapps/contentstore/views/preview.py", line 72, in preview_handler
    resp = instance.handle(handler, req, suffix)
  File "/openedx/venv/lib/python3.8/site-packages/xblock/mixins.py", line 84, in handle
    return self.runtime.handle(self, handler_name, request, suffix)
  File "/openedx/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1448, in handle
    return super().handle(block, handler_name, request, suffix=suffix)
  File "/openedx/venv/lib/python3.8/site-packages/xblock/runtime.py", line 1081, in handle
    results = handler(request, suffix)
  File "/openedx/venv/lib/python3.8/site-packages/lti_consumer/lti_xblock.py", line 1022, in lti_launch_handler
    lti_parameters = lti_consumer.generate_launch_request(self.resource_link_id)
  File "/openedx/venv/lib/python3.8/site-packages/lti_consumer/lti_1p1/consumer.py", line 311, in generate_launch_request
    oauth_signature = get_oauth_request_signature(
  File "/openedx/venv/lib/python3.8/site-packages/lti_consumer/lti_1p1/oauth.py", line 60, in get_oauth_request_signature
    raise Lti1p1Error("Failed to sign oauth request") from err
lti_consumer.lti_1p1.exceptions.Lti1p1Error: Failed to sign oauth request

I have also set up another OpenEdX instance as an LTI Provider and testing with those credentials gives the exact same error.
In order to make sure that I am not running into this bug I tried to install a newer version of oauthlib but that then breaks edx-platform which requires 3.0.1. Although, edx-platform has the xblock version 3.1.1, which should require oauthlib==3.1.1 ?
I’ve gone over the documentation, perhaps too many times to register what I am missing, please help :slightly_smiling_face:

@Jill perhaps you might be able to point me to the right direction?

Thanks!

My issue was solved via Slack by @giovannicimolin, The following values work:

Launch URL: https://saltire.lti.app/tool
ID: test
LTI passport: test:jisc.ac.uk:secret

Thanks again! :slight_smile:

1 Like