Superset Embedded SDK #36975
Replies: 3 comments 1 reply
|
The Superset Embedded SDK lets you securely embed Superset dashboards into your own web applications, typically using an iframe. It's designed for scenarios where you want users to view analytics inside your app without logging directly into Superset, and is the only officially supported method for embedding dashboards when using OAuth/SSO setups source. How to use it:
Troubleshooting:
For full details and code samples, check the official README. To reply, just mention @dosu. Docs are dead. Just use Dosu. |
|
@dosu I'm using default db auth for now. i have tenant wise roles and access to set of dashboards corresponding to these roles. is it possible to provide guest token to that particular role ? |
|
Short version of what the embedded SDK actually does, and then the tenant-role question — because that's the part that trips people up. What it's for
Superset does not hand guest tokens to the browser. Your app calls Minimal client side: import { embedDashboard } from "@superset-ui/embedded-sdk";
embedDashboard({
id: "<dashboard-uuid-from-embed-modal>",
supersetDomain: "https://superset.example.com",
mountPoint: document.getElementById("analytics-container"),
fetchGuestToken: () =>
fetch("/api/superset-guest-token").then((r) => r.text()),
dashboardUiConfig: { hideTitle: true },
});Server side you POST something like: {
"user": { "username": "tenant_acme_viewer" },
"resources": [{ "type": "dashboard", "id": "<uuid>" }],
"rls": [{ "clause": "tenant_id = 'acme'" }]
}Signed with Your tenant-role question No — a guest token does not map to your existing tenant FAB roles the way normal DB auth does. Every guest session gets whatever role Multi-tenant access is enforced in your token-minting code, not by picking a Superset role:
So tenant A never gets tenant B's dashboards because your API never puts them in the payload — not because Superset evaluated their FAB role inside the iframe. The trap: treating the guest token as "extend my logged-in user into Superset." It's a second auth system. Your app's session and the iframe JWT are parallel. RLS in the token is synthetic — whatever string your backend injects gets compiled into every query. Stale or missing clauses leak data even when the UI looks fine. Before it works at all
We wrote up the full flow — |
Uh oh!
There was an error while loading. Please reload this page.
@dosu can you tell me the use of embedde sdk and how to use it ?
All reactions