Authentication & Security
Secure your embed
Keep keys on your server, scope each token to one client and allow only your domains.
An embed is secure when your backend decides who sees what. Databrain then enforces it on every query.
Checklist
| Area | Do this |
|---|---|
| API key | Keep the data app API key on your server. Never send it to the browser. |
| Store the key | The full API key is shown once, when you create or rotate it. Store it then. Lists show only the last 4 characters. |
| Tenant | Set clientId from your own session on the server, never from a browser value. |
| Person | Send params.userIdentifier, so private items belong to one person. |
| Rows | Use params.tableAppFilters or app filters for limits inside a client. Viewers cannot change token values. |
| Dashboards | Use params.allowedEmbeds to list the dashboards a token can open. |
| Expiry | Set a short expiryTime. The default is 24 hours. Create a new token after a role change. |
| Domains | Add only your app’s domains to the whitelisted domains. Other origins get 403 UNAUTHORIZED_ORIGIN. |
| Features | Turn on only the end-user features you need in the embed’s Access control. |
How Databrain enforces scope
- Every query runs with the token’s
clientIdand the datasource’s tenancy level. tableAppFilterslimits every query that reads that table. A query it cannot filter is refused.- An embed request from a domain that is not whitelisted is refused with HTTP 403.
- Token values are stored on the server with the token. The browser only holds the token ID.
A SQL value in an app filter that fails or returns no rows runs the chart without that filter by default. Do not use SQL values as your only row limit. Use tableAppFilters or clientId tenancy.
Reports and certificates
Get Databrain’s current security documents from the Databrain security page.