Embedded Dashboard Rendering#
Overview#
Superset's embedding infrastructure lets external applications render dashboards inside iframes without requiring end-users to have Superset accounts. The feature is gated by the EMBEDDED_SUPERSET feature flag (default: False); enabling it unlocks the /embedded/<uuid> route, the REST API, and guest-token issuance.
Key Components#
1. EmbeddedDashboard Model#
superset/models/embedded_dashboard.py defines the embedded_dashboards table with three meaningful columns:
| Column | Type | Purpose |
|---|---|---|
uuid (PK) | UUID | Identifies the embed configuration; used in iframe src |
dashboard_id | FK → dashboards.id | Links to the underlying dashboard |
allow_domain_list | Text (comma-separated) | Domain allowlist; empty = any domain allowed |
The allowed_domains property splits the raw string into a list. An empty list means any origin can embed the dashboard.
2. Server-Side Route: /embedded/<uuid>#
superset/embedded/view.py — EmbeddedView.embedded() — handles the page load:
- Aborts with 404 if
EMBEDDED_SUPERSETis disabled . - Looks up the
EmbeddedDashboardrecord by UUID; aborts 404 if not found . - Validates the request
Refererheader againstallowed_domains; aborts 403 on mismatch . - Logs in an
AnonymousUserMixinfor the request scope, then renderssuperset/spa.htmlwith theembeddedJS entry point .
The bootstrap payload passes GUEST_TOKEN_HEADER_NAME and the resolved dashboard_id to the frontend .
3. Guest Token Authentication#
The host application backend calls POST /api/v1/security/guest_token/ to obtain a short-lived JWT. The default expiry is 300 seconds (5 minutes), configured via GUEST_TOKEN_JWT_EXP_SECONDS . The token payload carries:
- A synthetic user identity (
username,first_name,last_name) - A
resourceslist (dashboard UUIDs the token grants access to) - Per-dataset RLS
rlsrules ({ "clause": "...", "dataset": <id> })
On every API request the backend resolves the X-GuestToken header to a transient GuestUser. has_guest_access() checks that the requested dashboard UUID is in the token's resource list .
RLS clauses from the token are injected as SQL WHERE filters during query execution . Omitting the dataset field applies the clause globally to all datasets the token touches — always scope RLS rules with dataset in multi-datasource dashboards .
4. Embedded SDK (@superset-ui/embedded-sdk)#
The superset-embedded-sdk package (v0.2.0) is the official host-app integration point. Its single exported function, embedDashboard(), accepts:
id— the embed configuration UUIDsupersetDomain— e.g.https://superset.example.commountPoint— DOM element to inject the iframe intofetchGuestToken— callback that your backend calls to return a fresh guest tokendashboardUiConfig— optionalUiConfigTypefor UI chrome control
The SDK mounts an iframe pointed at /embedded/<id> , establishes a MessageChannel for bidirectional comms via @superset-ui/switchboard , and auto-refreshes the guest token before expiry .
The UiConfigType controls UI chrome via a bitmask passed as a uiConfig URL param :
dashboardUiConfig field | Bit |
|---|---|
hideTitle | +1 |
hideTab | +2 |
hideChartControls | +8 |
emitDataMasks | +16 |
The SDK also exposes methods on the returned EmbeddedDashboard handle: getScrollSize, getDashboardPermalink, getActiveTabs, observeDataMask, getDataMask, and setThemeConfig .
5. Standalone URL Parameter#
Independent of the SDK, any Superset dashboard URL supports a ?standalone=<n> query parameter to strip chrome for minimal embedding or screenshot use. Values come from the DashboardStandaloneMode enum:
| Value | Effect |
|---|---|
0 | Normal mode |
1 | Hide navigation bar |
2 | Hide navigation + title |
3 | Report mode (used by the screenshot scheduler) |
The standalone param is classified as a reserved URL parameter and is excluded from dashboard filter params .
Request Flow#
Configuration Checklist#
| Setting | Default | Notes |
|---|---|---|
EMBEDDED_SUPERSET (feature flag) | False | Must be True to enable all embedded routes |
GUEST_TOKEN_JWT_EXP_SECONDS | 300 | Token TTL; SDK auto-refreshes |
GUEST_TOKEN_HEADER_NAME | X-GuestToken | Header the frontend attaches to API requests |
allow_domain_list (per dashboard) | "" (any) | Comma-separated; validated against Referer |
CSP frame-ancestors | Not set | Must add your host origin to allow iframe embedding |
For CSP configuration, add a frame-ancestors directive to TALISMAN_CONFIG .
Key Source Files#
| File | Purpose |
|---|---|
superset/models/embedded_dashboard.py | EmbeddedDashboard ORM model |
superset/embedded/view.py | /embedded/<uuid> route, domain validation |
superset/security/api.py | POST /api/v1/security/guest_token/ endpoint |
superset/security/manager.py | create_guest_access_token, has_guest_access, get_guest_rls_filters |
superset-embedded-sdk/src/index.ts | SDK embedDashboard() implementation |
superset-frontend/src/dashboard/util/constants.ts | DashboardStandaloneMode enum |