This repo includes sample code referenced in the quick start guide for setting up interactive embedding with JWT.
You'll need a Pro or Enterprise version of Metabase up and running. If you're not sure where to start, sign up for Pro Cloud.
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.
Click the button to Save this as a dashboard. Metabase will save this dashboard in the collection called "Automatically generated dashboards".
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.
From any Metabase page, click on the gear icon in the upper right and select Admin Settings > Settings > Authentication.
On the card that says JWT, click the Setup button.
In JWT IDENTITY PROVIDER URI field, paste localhost:9090/login
.
Click the Generate key button. Copy the key.
Run:
npm install
You'll need to set some environment variables for your server.
export METABASE_SITE_URL="https://myapp.metabaseapp.com"
Replacing "https://myapp.metabaseapp.com" with the root path of your Metabase.
export METABASE_JWT_SHARED_SECRET="COPY_SECRET_FROM_JWT_CONFIG"
You can get this key from your Metabase by clicking on the gear icon and going to Admin Settings > Settings > Authentication > JWT.
If the dashboard you created above doesn't have an ID of 1, you'll also need to update the path:
export METABASE_DASHBOARD_PATH=`/dashboard/id`
Replacing id
with the ID number of your dashboard.
Start the server by running:
node index.js
The app runs by default on port 9090. If you want to run it on a different port, set the PORT
environment variable:
export PORT=8081
Visit http://localhost:9090/analytics and sign in with the following credentials:
user: [email protected]
password: foobar
Check out our quick start guide to set up interactive embedding with JWT and data sandboxing.
Please report bugs or feature requests as issues in this reporsitory. Please do not report security vulnerabilities on the public GitHub issue tracker. Our Security Policy describes the procedure for disclosing security issues.
This project is licensed under the MIT license. See the LICENSE file for more info.