Search results

Anonymous User Embedding

Anonymous embedding is an ideal solution for applications with a large number of users, where managing each user individually within Bold BI would be inefficient. Instead, anonymous embedding allows you to seamlessly integrate dashboards with a predefined, permission-based group on the BI server, providing a streamlined experience for your users.

Steps to Implement Anonymous Embedding

  • Enable the System User option in the UMS Accounts page. This allows you to manage anonymous users without creating individual accounts for each user. Systemuser

  • Create a new group and assign the necessary permissions for this group to access the necessary dashboards. grouplist

    grouppermission

Example: Generate Embed Token for Anonymous User shows how to generate an embed token for an anonymous user with group to access the necessary permission in v14.1.

Node

var http = require("http");
var https = require("https");
var express = require('express');
var cors = require('cors');
var app = express();

app.use(cors());
// Parse JSON bodies (as sent by API clients)
app.use(express.json());

app.post('/tokenGeneration', function (request, response) {
  const embedDetails = {
    serverurl: "<Bold BI Server URL>",
    siteidentifier: "<Site Identifier>",
    dashboard: {
      id: "<Dashboard Id>"
    },
    embedsecret: "<Embed Secret Key>",
    // Anonymous details
    email: "<Anonymous User Email>",
    anonymous: {
        isenabled: true,
        groupname: "<Group Name>"
    }
  }

  const parsedUrl = new URL(embedDetails.serverurl);
  const postData = JSON.stringify(embedDetails);
  const client = parsedUrl.protocol === 'https:' ? https : http;
  const options = {
    hostname: parsedUrl.hostname,
    port: parsedUrl.port || (parsedUrl.protocol === 'https:' ? 443 : 80),
    path: `${parsedUrl.pathname}/api/${embedDetails.siteidentifier}/embed/authorize`,
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Content-Length': Buffer.byteLength(postData)
    }
  };

  const authRequest = client.request(options, authResponse => {
    let result = '';
    authResponse.setEncoding('utf8');
    authResponse.on('data', chunk => result += chunk);
    authResponse.on('end', () => {
      const resultparse = JSON.parse(result);
      response.send(resultparse?.Data?.access_token);
    });
  });

  authRequest.on('error', (e) => {
    console.error("Error fetching embed token:", e.message);
  });

  authRequest.write(postData);
  authRequest.end();
});
Parameter Description
email Email of the anonymous user (not in Bold BI)
anonymous: { groupname: } The group name under which the anonymous user will be authorized

Embed the Dashboard for the Anonymous User

After generating the embed token, you can embed the dashboard into your frontend application using the Bold BI Embed SDK. The token will authorize the anonymous user based on the group assignment.

<div id="dashboard_container_id"></div>
<script>
    var boldbiEmbedInstance = BoldBI.create({
        serverUrl: "<Bold BI Server URL>",
        dashboardId: "<Dashboard Id>",
        embedContainerId: "dashboard_container_id",
        embedToken: "<Embed token generated from backend server>"
    });
    boldbiEmbedInstance.loadDashboard();  
</script>

Important: Anonymous user support is available only for the single dashboard viewer starting from Bold BI Version 10.1.18. It also supports Row-Level Security (RLS) for dynamic data filtering. You can find more details on implementing RLS here.