Skip to content

403 Error in Superset Embedded Mode with Gamma Guest Role  #32552

Closed

Description

@mostopalove

Bug description

When using Apache Superset in embedded mode with the Gamma role assigned to the guest user, charts fail to load data with a 403 error. The error message displayed is:

This endpoint requires the datasource *, database or all_datasource_access permission

Granting the all_datasource_access permission does not resolve the issue.

Steps to Reproduce

  1. Pull the latest Superset code from GitHub.
  2. Configure the application to work in embedded mode by setting:
FEATURE_FLAGS = {"EMBEDDED_SUPERSET": True}
GUEST_ROLE_NAME = "Gamma"
  1. Use the Gamma role for the guest user.
  2. Start the application using the following command:
docker compose up --build
  1. Open any dashboard and enable embedding.
  2. Use the dashboard ID in the frontend application (in this case, using @superset-ui/embedded-sdk).
  3. Open the frontend application in the browser.

Expected Behavior

The user should be able to view all charts with data.

Actual Behavior

All charts fail to load and display the following error:

This endpoint requires the datasource *, database or all_datasource_access permission

Granting the all_datasource_access permission does not fix the issue.

Screenshots/recordings

Root Cause Analysis

This bug appeared after the <Charts/> component was refactored. The issue occurs because the request is sent to the backend without the dashboardID in the form_data object. In the previous working implementation, this was correctly set, as seen in:

Previous working implementation

The refactored implementation can be found here:
Refactored <Charts/> component

Proposed Solution

The fix is simple and requires only two lines of code to ensure dashboardID is included in form_data:

const dashboardInfo = useSelector(state => state.dashboardInfo);
formData.dashboardId = dashboardInfo.id;

Screenshots

Before Fix:

Image

After Fix:

Image

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Activity

  1. dosubot commented on Mar 9, 2025

    @dosubot

    Hey @mostopalove! I'm here to help you with this Superset issue. I'm a bot that can assist you with bug fixes, answer questions, and guide you on becoming a contributor. Let's tackle this together!

    To resolve the 403 error in Apache Superset's embedded mode when using the Gamma role for a guest user, ensure that the dashboardID is included in the form_data object. The refactored <Charts/> component should add the dashboardID if it is present in the URL parameters. You can achieve this by using the useSelector function to access dashboardInfo and set the dashboardId in form_data as follows:

    const dashboardInfo = useSelector(state => state.dashboardInfo);
    formData.dashboardId = dashboardInfo.id;

    This change ensures that the dashboardID is correctly included in the form_data, which should help resolve the 403 error by allowing the backend to recognize the request context properly [1].

    To continue talking to Dosu, mention @dosu.


    Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

  2. changed the title [-]403 Error in Superset Embedded Mode with Gamma Guest Role[/-] [+]403 Error in Superset Embedded Mode with Gamma Guest Role [/+] on Mar 9, 2025
  3. sadpandajoe commented on Mar 10, 2025

    @sadpandajoe
    Member

    I think this may be related to #32219 if not a duplicate of the same issue.

  4. mostopalove commented on Mar 11, 2025

    @mostopalove
    ContributorAuthor

    @sadpandajoe Yes, it looks like the same issue. I believe my solution can also resolve #32219.

    I see that you've assigned @betodealmeida to fix it—he can use my research to apply the solution.

  5. rusackas commented on Mar 12, 2025

    @rusackas
    Member

    I'm sure @betodealmeida would appreciate the help if you'd be willing to open a PR. They're working on a million things :)

  6. mostopalove commented on Mar 12, 2025

    @mostopalove
    ContributorAuthor

    @rusackas I already have it on my computer but I don't have permission to push into github 😅

  7. betodealmeida commented on Mar 12, 2025

    @betodealmeida
    Member

    @mostopalove thanks for the report and fix! If you want to make a PR you need to first clone the Superset repo, and then push your changes to your fork; you'll then be able to create a PR.

    But I'm also happy to do this for you, whatever you prefer!

    Thanks!

  8. mostopalove commented on Mar 13, 2025

    @mostopalove
    ContributorAuthor

    @betodealmeida I've opened a PR, and it's ready for review: #32646. Let me know if you have any feedback!

  9. moved this from Done to Cherried in Apache Superset 5.0.0on Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions