Skip to content

metabase/metabase-nodejs-express-interactive-embedding-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Metabase Node.js interactive embedding sample

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.

Set up your Metabase

Create a dashboard

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.

Enable SSO with JWT

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.

JWT Identity provider URI

In JWT IDENTITY PROVIDER URI field, paste localhost:9090/login.

String used by the JWT signing key

Click the Generate key button. Copy the key.

Running the server

Install packages

Run:

npm install

Set environment variables

You'll need to set some environment variables for your server.

METABASE_SITE_URL

export METABASE_SITE_URL="https://myapp.metabaseapp.com"

Replacing "https://myapp.metabaseapp.com" with the root path of your Metabase.

METABASE_JWT_SHARED_SECRET

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.

METABASE_DASHBOARD_PATH

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.

Starting the app

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

Set up groups and data sandboxing

Check out our quick start guide to set up interactive embedding with JWT and data sandboxing.

Reporting issues

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.

Author

Metabase

License

This project is licensed under the MIT license. See the LICENSE file for more info.

About

Metabase Interactive Embedding Sample for Node.js

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •