How to Embed dashboards without Authorization Server REST API in JavaScript Embedding?
Embedding Bold BI dashboards into your application can be streamlined by using the JavaScript API, which allows for direct use of access tokens. This method eliminates the need to implement an Authorization Server REST API, simplifying the embedding process.
Using Access Tokens in JavaScript API
The JavaScript API provides an option to use the access token directly in the BoldBI.create()
method. This can be achieved using the token
member of the JavaScript API. This approach bypasses the need for an Authorization Server REST API.
Steps to Embed Using Access Tokens
-
Generate Access Token:
- Manually: You can manually generate an access token from the Bold BI profile page using the “Personal Access Token” option. This token can have an expiration period ranging from 7 to 45 days.
- Using REST API: Alternatively, you can generate the access token using the Authentication REST API. Note that tokens generated this way expire in 7 days.
-
Embed Dashboard:
- Use the generated access token in the
BoldBI.create()
method via JavaScript API membertoken
to authenticate and embed the dashboard in your application.
- Use the generated access token in the
Example Code Snippet
BoldBI.create({
serverUrl: "http://localhost:51777/bi/site/site1",
dashboardId: "755e99c7-f858-4058-958b-67577b283309",
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImRldm9wc0Bib2xkYmkuY29tIiwidXBuIjouYm9sZGJpZGVtby5jb20vYmkvc2l0ZS9zaXRlMSIsImF1ZCI6Imh0dHBzOi8vaG90Zml4LXdpbmRvd3MuYm9sZGJpZGVtby5jb20vYmkvc2l0ZS9zaXRlMSJ9.JzbqVr6Brv1mAEvnbHnE-FuShos", // Use the generated Access token by any one of the above methods.
});
Embedding Modules Supported
The following embedding modules can be achieved using the token
API member:
Important Notes
- The
token
API member is applicable to identifiers such as Dashboard ID, Datasource ID, Widget ID, and View ID. - If both the
token
API member and the Authorization Server REST API are used, thetoken
API member will take precedence.
References
- Steps to Embed Dashboars with Token API member
- Steps to generate “Personal Access Token”
- Authorization Server REST API for embedding the dashboard
- Bold BI REST API for generating access token
By following these steps, you can easily embed Bold BI dashboards into your application using the JavaScript API and access tokens, without the need for implementing an Authorization Server REST API.