GitHub user dosubot[bot] added a comment to the discussion: What will be the
payload of api/v1/security/login after enabling oauth?
<!-- Answer -->
To embed content when OAuth is enabled in Apache Superset, you can use the
Embedded SDK with a Guest Token for authentication. Here’s how you can do it:
1. Install the Embedded SDK using npm:
```sh
npm install --save @superset-ui/embedded-sdk
```
2. Use the `embedDashboard` function from the SDK and provide the necessary
parameters, including a function to fetch the Guest Token from your backend:
```js
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(), // Function to fetch
the Guest Token
dashboardUiConfig: {
hideTitle: true,
filters: {
expanded: true,
},
urlParams: {
foo: 'value1',
bar: 'value2',
}
},
iframeSandboxExtras: ['allow-top-navigation',
'allow-popups-to-escape-sandbox'],
referrerPolicy: "same-origin"
});
```
3. Ensure your backend creates a Guest Token by requesting Superset's `POST
/security/guest_token` endpoint and passes that token to your frontend.
This setup allows you to embed a Superset dashboard with OAuth enabled by using
a Guest Token for authentication
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-embedded-sdk/README.md)</sup>.
<!-- 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/2b5052ac-e3c0-4e1a-94b6-94747f4d78fe?feedback_type=great_response)
| [Irrelevant
Answer](https://app.dosu.dev/response-feedback/2b5052ac-e3c0-4e1a-94b6-94747f4d78fe?feedback_type=irrelevant_answer)
| [Incorrect
Sources](https://app.dosu.dev/response-feedback/2b5052ac-e3c0-4e1a-94b6-94747f4d78fe?feedback_type=incorrect_sources)
| [Too
Verbose](https://app.dosu.dev/response-feedback/2b5052ac-e3c0-4e1a-94b6-94747f4d78fe?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/2b5052ac-e3c0-4e1a-94b6-94747f4d78fe?feedback_type=hallucination)
| [Bug
Report](https://app.dosu.dev/response-feedback/2b5052ac-e3c0-4e1a-94b6-94747f4d78fe?feedback_type=bug_report)
|
[Other](https://app.dosu.dev/response-feedback/2b5052ac-e3c0-4e1a-94b6-94747f4d78fe?feedback_type=other)</sup>
GitHub link:
https://github.com/apache/superset/discussions/33034#discussioncomment-12763280
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]