Socket
Socket
Sign inDemoInstall

@suddjian/superset-embedding-test

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@suddjian/superset-embedding-test

Embedded SDK for Superset


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Superset Embedded SDK

The Embed SDK allows you to embed dashboards from Superset into your own app, using your app's authentication.

Embedding is done by inserting an iframe, containing a Superset page, into the host application.

Embedding a Dashboard

Using npm:

npm install --save @superset-ui/embedded-sdk
import { embedDashboard } from "@superset-ui/embedded-sdk";

embedDashboard({
  id: "abc123", // given by the Superset embedding UI
  supersetDomain: "https://superset.example.com",
  mountPoint: document.getElementById("my-superset-container"), // any html element that can contain an iframe
  fetchGuestToken: () => fetchGuestTokenFromBackend(),
});

You can also load the embedded SDK from a CDN. The library will be available as supersetEmbeddedSdk globally:

<script src="https://unpkg.com/@superset-ui/embedded-sdk"></script>

<script>
  supersetEmbeddedSdk.embedDashboard({
    // ... here you supply the same parameters as in the example above
  });
</script>

Authentication/Authorization with Guest Tokens

Embedded resources use a special auth token called a Guest Token to grant Superset access to your users, without requiring your users to log in to Superset directly. Your backend must create a Guest Token by requesting Superset's POST /security/guest_token endpoint, and pass that guest token to your frontend.

The Embedding SDK takes the guest token and use it to embed a dashboard.

Creating a Guest Token

From the backend, http POST to /security/guest_token with some parameters to define what the guest token will grant access to. Guest tokens can have Row Level Security rules which filter data for the user carrying the token.

The agent making the POST request must be authenticated with the can_grant_guest_token permission.

Example POST /security/guest_token payload:

{
  "user": {
    "username": "stan_lee", // these user parameters are optional but can be useful
    "first_name": "Stan",
    "last_name": "Lee"
  },
  "resources": [{
    "type": "dashboard",
    "id": "abc123"
  }],
  "rls": [
    { "clause": "publisher = 'Nintendo'" }
  ]
}

FAQs

Package last updated on 02 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc