You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Kranthi32 (via GitHub)" <gi...@apache.org> on 2025/06/24 21:33:02 UTC
[D] Refresh embedded dahboard getting logiut supersetapp and embedded dasboard geeting forbidded [superset]
GitHub user Kranthi32 created a discussion: Refresh embedded dahboard getting logiut supersetapp and embedded dasboard geeting forbidded
### Bug description
I created a user and assaigned public ,gama role.i am new to this plz shpport
Superset config below first time loadijng second tine refresh supersetapp logs out and embedded dashboard 403
FEATURE_FLAGS = {"ALERT_REPORTS": True,"EMBEDDED_SUPERSET": True}
ALERT_REPORTS_NOTIFICATION_DRY_RUN = True
WEBDRIVER_BASEURL = "http://superset:8088/"
WEBDRIVER_BASEURL_USER_FRIENDLY = WEBDRIVER_BASEURL
SQLLAB_CTAS_NO_LIMIT = True
WTF_CSRF_ENABLED = False
ENABLE_CORS = True
ALLOW_CORS = True
CORS Enabling
CORS_OPTIONS = {
"supports_credentials": True,
"allow_headers": "",
"expose_headers": "",
"resources": "*",
"origins": ["http://localhost:3000","http://localhost:8088"]
}
OVERRIDE_HTTP_HEADERS = {'X-Frame-Options': 'ALLOWALL'}
TALISMAN_ENABLED = False
GUEST_ROLE_NAME = "Gamma"
### Screenshots/recordings
_No response_
### Superset version
master / latest-dev
### Python version
3.9
### Node version
16
### Browser
Chrome
### Additional context
_No response_
### Checklist
- [x] #32906
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] 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.
GitHub link: https://github.com/apache/superset/discussions/33892
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Refresh embedded dahboard getting logiut supersetapp and embedded dasboard geeting forbidded [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
GitHub user dosubot[bot] added a comment to the discussion: Refresh embedded dahboard getting logiut supersetapp and embedded dasboard geeting forbidded
<!-- Answer -->
I found some similar discussions that might be relevant to your issue:
1. [Don't work "Edit chart" in Embedded dashboard](https://github.com/apache/superset/discussions/29560) - This discussion is still open and might provide insights into issues with embedded dashboards <sup>[[1]](https://github.com/apache/superset/discussions/29560)</sup>.
2. [Issues embedding dashboard in public website](https://github.com/apache/superset/discussions/31442) - This is another open discussion that could be related to your problem with embedding dashboards <sup>[[2]](https://github.com/apache/superset/discussions/31442)</sup>.
Regarding your issue with the 403 Forbidden error and logout on refresh, here are some points to consider:
1. **403 Forbidden Error**: This can occur due to missing `dashboardID` in the `form_data` object. Ensure that the `dashboardID` is included in the `form_data` object to avoid permission errors <sup>[[3]](https://github.com/apache/superset/issues/32552)</sup>.
2. **Session Management**: Superset uses guest tokens for session management in embedded dashboards. If there's an issue with the guest token, it can lead to session interruptions and 401 errors. Ensure that the guest token is generated correctly <sup>[[4]](https://github.com/apache/superset/blob/master/superset-frontend/src/embedded/index.tsx)</sup>.
3. **Role Configuration**: The `GUEST_ROLE_NAME` is set to "Gamma". Ensure that the "Gamma" role has the necessary permissions to access the embedded dashboards. Missing permissions can lead to access issues <sup>[[5]](https://github.com/apache/superset/blob/master/superset-embedded-sdk/README.md)</sup>.
4. **CORS Configuration**: Your `CORS_OPTIONS` seem to be set up to allow requests from specific origins. Ensure that these settings are correct and that the domains from which you are accessing the dashboard are included <sup>[[6]](https://github.com/apache/superset/blob/master/docs/docs/configuration/networking-settings.mdx)</sup>.
5. **CSRF Protection**: Disabling CSRF protection (`WTF_CSRF_ENABLED = False`) can lead to security vulnerabilities. It's generally recommended to keep this enabled in production environments <sup>[[7]](https://github.com/apache/superset/blob/master/tests/integration_tests/superset_test_config.py)</sup>.
Review these points and adjust your configuration accordingly to resolve the issues with your embedded dashboard.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
---
<sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/e64bd498-806a-4163-a231-d0028248c632?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/e64bd498-806a-4163-a231-d0028248c632?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/e64bd498-806a-4163-a231-d0028248c632?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/e64bd498-806a-4163-a231-d0028248c632?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e64bd498-806a-4163-a231-d0028248c632?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/e64bd498-806a-4163-a231-d0028248c632?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/e64bd498-806a-4163-a231-d0028248c632?feedback_type=other)</sup>
GitHub link: https://github.com/apache/superset/discussions/33892#discussioncomment-13566755
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Refresh embedded dahboard getting logiut supersetapp and embedded dasboard geeting forbidded [superset]
Posted by "Kranthi32 (via GitHub)" <gi...@apache.org>.
GitHub user Kranthi32 added a comment to the discussion: Refresh embedded dahboard getting logiut supersetapp and embedded dasboard geeting forbidded
I created user settings -) list of users -) role public
Another user gama role
2 running react application dashboard showing
3 immediately superset app logging out
4 after refresh my react app showing guest token issue first time perfectly loading
5 again i login into superset app. And react applivation chats loading.
Is it need loginto superset application every time?
Please support i am new to this
i added react code like this
my react application
"use client";
import React, { useEffect } from "react";
import axios from "axios";
import { embedDashboard } from "@superset-ui/embedded-sdk";
const supersetUrl = "http://localhost:8088/";
const supersetApiUrl = ${supersetUrl}/api/v1/security;
const dashboardId = "af70a229-7d8e-4917-8ce3-795ca257fa85";
const DashboardPage = () => {
useEffect(() => {
async function getToken() {
try {
const loginBody = {
password: "admin",
provider: "db",
refresh: true,
username: "sracharts",
};
const { data } = await axios.post(
${supersetApiUrl}/login,
loginBody,
{ headers: { "Content-Type": "application/json" }, withCredentials: true, }
);
const accessToken = data.access_token;
console.log("Access Token:", accessToken);
/*** Step 2: Fetch Guest Token ***/
const guestTokenBody = JSON.stringify({
resources: [{ type: "dashboard", id: dashboardId }],
rls: [{"clause": "customer_id=4"}],
user: { username: "sracharts", first_name: "Sra", last_name: "Application" },
});
const guestTokenResponse = await axios.post(
`${supersetApiUrl}/guest_token/`,
guestTokenBody,
{ headers: { "Content-Type": "application/json", Authorization: `Bearer ${accessToken}` }, withCredentials: true, }
);
const guestToken = guestTokenResponse.data.token;
console.log("Guest Token:", guestToken);
/*** Step 3: Embed Dashboard ***/
const mountPoint = document.getElementById("superset-container");
if (!mountPoint) {
console.error("Error: mountPoint is null.");
return;
}
console.log('mount points')
embedDashboard({
id: dashboardId,
supersetDomain: supersetUrl,
mountPoint,
fetchGuestToken: () => guestToken,
dashboardUiConfig: {
filters: { expanded: true },
urlParams: { standalone: 3 },
},
});
/*** Step 4: Adjust Iframe Styles ***/
setTimeout(() => {
const iframe = document.querySelector("iframe");
if (iframe) {
iframe.style.width = "100%";
iframe.style.minHeight = "100vh";
}
}, 1000);
} catch (error) {
console.error("Error fetching token:", error);
}
}
getToken();
}, []);
GitHub link: https://github.com/apache/superset/discussions/33892#discussioncomment-13566756
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org