openedx / xblock-lti-consumer

GNU Affero General Public License v3.0
28 stars 84 forks source link

Cannot access LTI Deep Link response in OpenEdx #484

Open besonn opened 4 months ago

besonn commented 4 months ago

Hi there, I was trapped in some errors about deploying an LTI tools in edx-platform.

I run both edx and LTI tools on a local machine. Edx uses port 8000 and 8001, and lti tools uses 9001.

For edx, I use:

tutor mounts add ./edx-platform
tutor images build openedx-dev
tutor dev launch

which is in tutor dev

For LTI Tools, I use: pylti1.3-flask-example, which is running on 127.0.0.1:9001

So, When I tried to launch deep link in openedx. It returns Please check that you have course staff permissions and double check this block's LTI settings. I am sure that I was using a staff account. And I am quite sure I have set DCS_SESSION_COOKIE_SAMESITE = 'None' in edx-plarform/lms/env/.

I noticed that #218 mentioned the similar problems.

The error log in edx is below:

lms-1            | 2024-06-19 17:10:13,641 WARNING 114 [lti_consumer.plugin.views] [user None] [ip 172.19.X.X] views.py:496 - Permission on LTI Config <LtiConfiguration: [CONFIG_ON_XBLOCK] lti_1p3 - block-v1:edX+DemoX+Demo_Course+type@lti_consumer+block@ba1ec764026346b39f2cb233dce4f01a> denied for user <SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object at 0x7f270d1e75e0>>:
lms-1            | 2024-06-19 17:10:13,648 DEBUG 114 [django.db.backends] [user None] [ip 172.19.X.X] utils.py:161 - (0.000) COMMIT; args=None; alias=default
lms-1            | [19/Jun/2024 17:10:13] "POST /api/lti_consumer/v1/lti/8/lti-dl/response HTTP/1.1" 403 7093

I masked my ip address in error log. How to solve this problem?

Thanks.

besonn commented 4 months ago

The tutur version is 17.0.5, and the edx-platform version is quince.

ichintanjoshi commented 4 months ago

Facing the same

besonn commented 4 months ago

@ichintanjoshi We seemed to solve this problem. Are you running edx on tutor? If so, you need to modify the SAMESITE in tutor.

ichintanjoshi commented 4 months ago

@ichintanjoshi We seemed to solve this problem. Are you running edx on tutor? If so, you need to modify the SAMESITE in tutor.

Yes, in tutor,

I've set DCS_SESSION_COOKIE_SAMESITE as 'None'

Do we also need to set SAMESITE as 'None' ?

besonn commented 4 months ago

@ichintanjoshi Here is our findings: the modification of DCS_SESSION_COOKIE_SAMESITE in edx-platform seems helpless. So we install tutor in source document, then we modify the source code of tutor (lax to none) tutor

And we run tutor in dev, it works.

But it could not access lms or cms in Chrome, Because of get-ready-for-new-samesitenone-secure. It works in firefox, I think it is enough for us to debug in dev mode.

ichintanjoshi commented 4 months ago

Okay @besonn thanks, I will try to replicate the same