|
| 1 | +# Metabase Embedding SDK for React sample |
| 2 | + |
| 3 | +You'll need a Pro or Enterprise version of Metabase 50 up and running. If you're not sure where to start, sign up for [Pro Cloud](https://www.metabase.com/pricing). |
| 4 | + |
| 5 | +> [!IMPORTANT] |
| 6 | +> The SDK is currently only compatible with Metabase 50 |
| 7 | +
|
| 8 | +## Create .env file |
| 9 | +```sh |
| 10 | +cp .env.example .env |
| 11 | +``` |
| 12 | + |
| 13 | +## Adjust URLs |
| 14 | +In `.env`, make sure `REACT_APP_METABASE_INSTANCE_URL` and `METABASE_INSTANCE_URL` point to your Metabase instance URL, e.g. `http://localhost:3000`. |
| 15 | + |
| 16 | +## Set up your Metabase |
| 17 | + |
| 18 | +### Enable SSO with JWT |
| 19 | + |
| 20 | +From any Metabase page, click on the **gear** icon in the upper right and select **Admin Settings** > **Settings** > **Authentication**. |
| 21 | + |
| 22 | +On the card that says **JWT**, click the **Setup** button. |
| 23 | + |
| 24 | +### JWT Identity provider URI |
| 25 | + |
| 26 | +In **JWT IDENTITY PROVIDER URI** field, paste `localhost:9090/sso/metabase`. |
| 27 | + |
| 28 | +### String used by the JWT signing key |
| 29 | + |
| 30 | +Click the **Generate key** button. Copy the key and paste it in your `.env` file into the env var `METABASE_JWT_SHARED_SECRET`. |
| 31 | + |
| 32 | +## Running the server |
| 33 | + |
| 34 | +### Move into the directory |
| 35 | + |
| 36 | +```sh |
| 37 | +cd server |
| 38 | +``` |
| 39 | + |
| 40 | +### Install packages |
| 41 | + |
| 42 | +```sh |
| 43 | +npm install |
| 44 | +``` |
| 45 | + |
| 46 | +### Starting the server |
| 47 | + |
| 48 | +```sh |
| 49 | +npm start |
| 50 | +``` |
| 51 | + |
| 52 | +## Start the client |
| 53 | + |
| 54 | +### Move into the directory |
| 55 | + |
| 56 | +In a different terminal |
| 57 | +```sh |
| 58 | +cd client |
| 59 | +``` |
| 60 | +### Install dependencies |
| 61 | + |
| 62 | +```sh |
| 63 | +npm install |
| 64 | +``` |
| 65 | + |
| 66 | +### Start the app |
| 67 | + |
| 68 | +```sh |
| 69 | +npm start |
| 70 | +``` |
| 71 | +Your browser should automatically open the app. By default, it runs on [http://localhost:3100](localhost:3100). |
| 72 | + |
| 73 | +## Set up groups and data sandboxing |
| 74 | + |
| 75 | +Check out our [quick start guide](https://www.metabase.com/learn/customer-facing-analytics/interactive-embedding-quick-start) to set up interactive embedding with JWT and data sandboxing. |
| 76 | + |
| 77 | +## Reporting issues |
| 78 | + |
| 79 | +Please report bugs or feature requests as issues in this repository. Please do not report security vulnerabilities on the public GitHub issue tracker. Our Security Policy describes [the procedure](https://github.com/metabase/metabase/security#reporting-a-vulnerability) for disclosing security issues. |
| 80 | + |
| 81 | +## Author |
| 82 | + |
| 83 | +[Metabase](https://metabase.com) |
| 84 | + |
| 85 | +## License |
| 86 | + |
| 87 | +This project is licensed under the MIT license. See the [LICENSE](./LICENSE) file for more info. |
0 commit comments