You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the sample code for the Metabase Node.js Interactive Embedding Quickstart.
3
+
Sample code for the Metabase Node.js Interactive Embedding Quickstart LINK.
4
4
5
-
Please check out the code for an example of how to integrate interactive embedding into your Node.js applications.
5
+
You'll need a paid version of Metabase up and running. If you're not sure where to start, sign up for Metabase Cloud: Pro. LINK.
6
6
7
-
## What is Metabase?
7
+
## Set up your Metabase
8
8
9
-
## Running the sample code
10
-
1. Make sure you have updated enabled JWT for SSO under admin settings, and you have entered your app's SSO endpoint as the JWT Identity Provider URI. The path is `/sso/metabase`, e.g. `http://localhost:8080/sso/`metabase
11
-
2. Make sure you define the following env vars defined:
12
-
**`export METABASE_SITE_URL="https://myapp.metabaseapp.com"` - the root path of your Metabase instance,
13
-
**`export METABASE_JWT_SHARED_SECRET="COPY_SECRET_FROM_JWT_CONFIG"` - you grab this from the SSO JWT config in admin settings
14
-
3. Create a dashboard using X-ray on the invoices table in the sample dataset. If the ID is not 1, then update `METABASE_DASHBOARD_PATH` in `index.js`.
15
-
3. Start the sample with `node index.js`. It runs by default on port 8080.
16
-
4. Hit http://localhost:8080, sign in and hit `/analytics` with both users to populate them to Metabase.
17
-
5. Create groups `Customer Acme` and `Customer Fake` and configure permissions so they can access the collection in which the dashboard is located. Also, setup data sandboxing on the Invoices table filtering on `accountId`.
18
-
6. Under SSO then activate group membership syncing and map `Customer-Acme` and `Customer-Fake` to the groups you've created.
19
-
7. You should be able to sign in with the two users and see the dashboard. If not, check the collection permissions for their respective groups.
20
-
8. Both users should be able to see the same dashboard but with different data, beacuse of sandboxing.
9
+
### Create a dashboard
21
10
22
-
## Create a free Metabase trial
11
+
In the left nav, go to **Browse data** > **Sample Database**. Hover over the `Invoices` table and click on the lightning bolt to X-ray the table.
23
12
24
-
* For interactive embedding, you will need a Pro or Enterprise plan.
25
-
* You can sign up for a free trial at https://store.metabase.com/checkout
13
+
Click the button to **Save this** as a dashboard. Metabase will save this dashboard in the collection called "Automatically generated dashboards".
14
+
15
+
Visit that dashboard in the "Automatically generated dashboards" and make a note of its URL. If it's the first dashboard you created, it's probably `/dashboard/1` followed by a description.
16
+
17
+
### Enable SSO with JWT
18
+
19
+
From any Metabase page, click on the **gear** icon in the upper right and select **Admin Settings** > **Settings** > **Authentication**.
20
+
21
+
On the card that says **JWT**, click the **Setup** button.
22
+
23
+
### JWT Identity provider URI
24
+
25
+
In **JWT IDENTITY PROVIDER URI** field, paste `localhost:8080/login`.
26
+
27
+
### String used by the JWT signing key
28
+
29
+
Click the **Generate key** button. Copy the key.
30
+
31
+
## Running the server
32
+
33
+
### Install packages
34
+
35
+
Run:
36
+
37
+
```sh
38
+
npm install
39
+
```
40
+
41
+
### Set environment variables
42
+
43
+
You'll need to set some environment variables for your server.
You can get this key from your Metabase by clicking on the **gear** icon and going to **Admin Settings** > **Settings** > **Authentication** > **JWT**.
63
+
64
+
### METABASE_DASHBOARD_PATH
65
+
66
+
If the dashboard you created above doesn't have an ID of 1, you'll also need to update the path:
67
+
68
+
```sh
69
+
export METABASE_DASHBOARD_PATH=`/dashboard/id`
70
+
```
71
+
72
+
Replacing `id` with the ID number of your dashboard.
73
+
74
+
## Starting the app
75
+
76
+
Start the server by running:
77
+
78
+
```sh
79
+
node index.js
80
+
```
81
+
82
+
The app runs by default on port 8080.
83
+
84
+
Visit [http://localhost:8080/analytics](localhost:8080/analytics) and sign in with the following credentials:
Create groups `Customer Acme` and `Customer Fake` and configure permissions so they can access the collection in which the dashboard is located. Also, setup data sandboxing on the Invoices table filtering on `accountId`.
96
+
97
+
Under SSO then activate group membership syncing and map `Customer-Acme` and `Customer-Fake` to the groups you've created.
98
+
8. You should be able to sign in with the two users and see the dashboard. If not, check the collection permissions for their respective groups.
99
+
100
+
## Set up sandboxing
101
+
102
+
TODO
103
+
104
+
Both users should be able to see the same dashboard but with different data, beacuse of sandboxing.
26
105
27
106
## Reporting issues
28
107
@@ -34,4 +113,4 @@ Please report bugs or feature requests as issues in this reporsitory. Please do
34
113
35
114
## License
36
115
37
-
This project is licensed under the MIT license. See the [LICENSE](./LICENSE) file for more info.
116
+
This project is licensed under the MIT license. See the [LICENSE](./LICENSE) file for more info.
0 commit comments