Solution Patterns
Share one dashboard with many clients
Build a dashboard once and show each customer only their own rows.
You build one dashboard. Each customer sees only their data, because the guest token’s clientId scopes every query.
Before you start
- The datasource has a tenancy level set. See Tenancy model.
- The dashboard is in a data app as an embed.
Steps
- In your backend, find the customer company of the signed-in user. Never take it from the browser.
- Create a guest token with that company as
clientId:
{
"clientId": "acme-corp",
"dataAppName": "Customer Analytics",
"params": {
"userIdentifier": "jane@acme.example"
}
}- Send the token to the page and render
<dbn-dashboard token="..." dashboard-id="YOUR_DASHBOARD_ID">.
Each customer now sees the same dashboard with only their rows.
What clientId must be
| Tenancy level | clientId |
|---|---|
| Table | A value in the customer table’s primary key column |
| Database | The tenant’s schema name |
| Multi-database | The tenant’s database name |
What each person keeps
Some changes are per client, some per person:
- Per client (
clientId): metrics hidden with Manage metrics. Everyone at that customer sees the change. - Per person (
params.userIdentifier): metrics they create and make private, and their scheduled reports.
If something goes wrong
- 400
CLIENT_ID_ERROR: “Client ‘<id>’ was not found in data app ‘<name>’.” On table tenancy, use a value from the client column. On database tenancy, use the schema or database name. If the tenant is new, run Sync schema on the datasource first.