Error: invalid_request when trying to access to superset

Hello!

I’m having troubles with Django OAuth Toolkit superset’s configuration in Aspects. I am using tutor contrib aspects 2.3.1 and tutor 19.0.5, and building the project in Docker, with tutor local …

If I build the application from scratch, I cannot access superset due to a Mismatching redirect URI error:

While my intial configuration in Django OAuth Toolkit for superset-sso application shows a redirect-uri like this: https://superset-uamx-pre.uam.es/oauth-authorized/openedxsso, both links from inside LMS (the link in Reports) and outside LMS (the URL https://superset-uamx-pre.uam.es/) when trying to log into superset it generates a URL like this: https://uamx-pre.uam.es/oauth2/authorize/?response_type=code&client_id=XXXXXXXX&redirect_uri=http%3A%2F%2Fsuperset-uamx-pre.uam.es%3A443%2Foauth-authorized%2Fopenedxsso&scope=profile+email+user_id&state=XXXXXXXX

You can see that the redirect_uri param (redirect_uri=http%3A%2F%2Fsuperset-uamx-pre.uam.es%3A443%2Foauth-authorized) includes the port (443) that is the Caddy’s header_up X-Forwarded-Port 443 parameter.

So I tried to change the supserset-sso Django OAuth Toolkit configuration to match the redirect_uri param (http://superset-uamx-pre.uam.es:443/oauth-authorized/openedxsso), using http instead of https protocol and adding the 443 port. This worked for the direct access to Superset (https://superset-uamx-pre.uam.es) but NOT for the access within the LMS (in the Reports tab)

I can see the Reports in the Reports tab perfectly, so I don’t know what can be happening…

Thank you very much for your support
Bests!

Hi @Yago - I’m not sure what the solution is here but there are a few things you can try:

Include these in your local environment

import os
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'

SUPERSET_CONFIG["internal_service_url"] = "http://superset:8088"

Install the newer version of platform_plugin_aspects which fixes a guest token error with Superset

pip install "platform-plugin-aspects==v1.1.1"

When you run tutor local launch make sure ENABLE_HTTPS is false

As you are not running this platform in production, we automatically set the following configuration values:
    LMS_HOST = local.openedx.io
    CMS_HOST = studio.local.openedx.io
    ENABLE_HTTPS = False

This worked for the direct access to Superset (https://superset-uamx-pre.uam.es) but NOT for the access within the LMS (in the Reports tab)

Is it the same mismatch URI error when you try to access through the reports tab?