Embed in your product
What your application does, and what GOAT does.
This guide is for developers putting GOAT dashboards inside their own product. It covers the parts involved, who does what, and the order to read the pages in.
The parts
| Part | What it does |
|---|---|
| Your page | Holds the dashboard element and the snippet from GOAT. |
| Your backend | Knows who the signed-in user is and which of your customers they belong to. It asks GOAT for a viewer token for that customer. |
| The API key | Your backend's secret for asking GOAT for tokens. It never reaches the browser. |
| The viewer token | A short-lived pass that names the tenant, meaning which of your customers the viewer belongs to. The page sends it with every request. |
| GOAT | Checks the token, checks the tenant can see the dashboard, and returns that tenant's rows only. |
Who does what
| Step | Who | Where |
|---|---|---|
| Build and publish the dashboard | An author | Publish and share |
| Create an API key | An Admin | API keys |
| Register your customers as tenants | You, by an API call with an Admin's or Author's own sign-in token | Tenants and access |
| Add a token endpoint to your backend | You | Viewer tokens |
| Paste the snippet into your page | You | Embed a dashboard |
The app has no control yet for registering customers, and does not yet give a way to get that sign-in token. An Admin can instead turn on an install setting, through the settings API, that registers each customer at its first token request. Tenants and access explains it and its trade-off.
Rules that keep customers apart
- Decide the tenant on your server, from your own sign-in, never from anything the browser sends.
- Keep the API key on your server.
- A viewer sees only dashboards that are published and that their tenant has access to, and only their tenant's rows.
Read next
- Embed a dashboard: the snippet and what each part does.
- Viewer tokens: the token request and its answers.
- Tenants and access: registering customers and granting access.
- Embed options and Content Security Policy, as you need them.
The Quickstart runs through all of it once, with a test customer.