The Looker embed SDK repository includes sample code and a simple demo of the embed SDK. Because of Looker’s attention to security, the demo requires a bit of setup. The demo also requires your Looker embed secret. The embed secret grants access to all of your data, so note the following:
- Do not share your secret with anyone you do not want to have complete access to your instance.
- Do not reset your secret if you already are using it in another context.
- Do not set up your code to store the secret in the web browser.
Step 1: Enable embedding in your Looker instance
This is documented in more detail on the Single Sign-on (SSO) Embedding documentation page.
- Navigate to Admin > Platform Embed on your Looker instance. This requires Admin privileges.
- The demo server runs by default at
http://localhost:8080. By adding that address to the Embedded Domain Allowlist you can enable the demo to receive messages from Looker.
- Turn on Embed Authentication.
- In order to view your embed secret you must reset it. Copy the secret to a secure place.
Step 2: Customize the demo settings for your Looker instance
Provide your embed secret to the server. You can do this a couple ways:
- Set it as
LOOKER_EMBED_SECRETin your shell environment.
- Create a file named
.envin the root of the sdk directory. Add a line to that file:
Provide your Looker instance host address to the server by either:
- Setting it as
LOOKER_EMBED_HOSTin your shell environment.
demo/demo_config.ts file to be appropriate for the pages you want to embed.
demo/demo_user.json file to be appropriate for the type of user you want to embed.
Step 3: Build and run the demo
The server will print out what host and port it is running on. If it is different than
http://localhost:8080 then you will need to add it to your Embedded Domain Allowlist.
npm run python
The server will print out what host and port it is running on.
You may need to
pip install six to install the Python 2/3 compatibility layer.