We need to create a user in Looker before we try to embed a dashboard but having trouble figuring out if it is even possible to create one with the API. I’ve tried posting to the create user endpoint with embedcredentials populated, but no luck. There is also no endpoint listed in the documentation to create embed credentials on their own like you can with other credential types. Has anybody had any luck with this?
Already have an account? Login
Login to the community
No account yet? Create an account
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
It is possible to create an embed user via the API with the create user endpoint as long as you provide arguments for the credentials_embed array.
It is also possible to create users with the examples provided in our SSO examples GitHub repository. This doubles as an efficient way to build the embed URL too.
For more information please see our sso embed documentation.
Hoping this helps!
I gave that a shot yesterday but realized none of the embedded credentials were being sent to the api because in the swagger file they are all marked as readonly, this causes the generated .net client to not serialize them to json at all when posting the new user. That seems like an error in the swagger definition.
But I corrected it on my end so embed creds are definitely being posted, but the user is still being created as just a standard looker user. Here is the sample request:
Would you mind explaining your use case for creating the user first?
When we create users with a script at the same time as the embed url, as shown in our SSO examples GitHub repository that Bernard linked to above, we declare the permissions that user should have as part of creating them.
Embed users don’t usually get direct access to Looker - they access through the application or site where you’re embedding, so they don’t have credentials in the same way that Looker users do.
Hi Molly - We are rolling our own filter implementation that is outside of the iframe. In order to get potential filter values we are using the query api, but this must be run in the context of the current user for data security. In our system we store the clientid and secret with our user records, if those are blank then we hit the endpoint to create api3 credentials for the user. This is a problem if the user does not yet exist in Looker.
To mitigate not being able to create the user with the api, we are showing an intermediate page after they login to our system that has a 1x1 iframe pointing to a blank dashboard. This way we are sure the user now exists in Looker. A bit of a hack for sure and something we will always need to remember to carry forward as the product evolves.
If you look at the previous comment. The SSO method of integrating and doing exactly what you are after is in there. We are doing this for our current and two future projects and it works without the need for API integration and allows for queries to be run as the current user, with external filtering. You just need to know how to compile the IFrame URL.
I’d like to chime in because we’re doing something similar. We’d like to create an embed user with API credentials, so that we can display embedded iframes and custom graphs using data from the API in our own portal. Part of the reason we want to do this is because loading several iframes at a time can be cumbersome.
We’d like to do this by creating the embedded user first (on login to the portal) with API keys, and then generate the embeds/graphs afterwards. I suppose we could work around this by loading the iframe from our portal server, doing a search for the user (based on the external_id), and then generating the API keys, but this is a little hacky and doesn’t seem to be a good practice.
I hope all is well! Would you mind elaborating on why the SSO embedding option would not fulfill the needs of this use case? Just trying to ensure that I have a clear understanding on my end.
The main use case here is mixed use of embeds and API calls. There are two reasons for this:
Speed - in one dashboard of our portal, we’re embedding 6 iframes, 4 of which are single stat visualizations. Loading up 6 iframes is slow, and we’d like to display the single stat metrics without an iframe, so that it will render faster.
Look and feel - given the example in #1, while the graph type visualizations look good while embedded as an iframe, the single stat metrics don’t fit in as well. I think they will look much better if we can style them using our own CSS framework.
I’ve thought about creating a regular user via the API, but then I’m not sure if the embeds will work unless Looker supports passing the access token as a GET variable. Even if that works, I’d rather not have the Looker access token accessible by the user, and would prefer to route any API type requests through our own service.
Thanks for the explanation! We might be able to use the login_user endpoint to create access tokens for your embed users - these users would already need to exist, but then you could use their individual access tokens for API calls.
I know this is an old thread, but something that a number of my clients do is the following:
I wrote more about this here. Check it out!
I did exactly what you suggests but its not working.
When I call the endpoint /api/4.0/queries/run/ with the embed user token, I receive a 404 error.
Can you please help me out?
The problem was I created an embed user that did not have access to any model.
After I assign the user to a group it worked perfectly!
@ezmarques! glad you were able to get things to work! By the way, I see you’re using the 4.0 version of Looker’s API. This is an experimental version of our API. I would recommend not using it in any production environment. The 3.1 version is the current stable version.
Hi Guys, the SSO embed URL works fine for me , but when am trying to use the API to create embed user , the user gets created as normal looker user and embed credentials and groups I assigned is not reflecting. even the response for embed credential is blank. Can someone help
“display_name”: “Testing API”,
It is not possible to create embed users with the API. If you construct an SSO url and make a get request through server side code, or put it in an 1x1 iframe on a page it will create the user. After that you can do API calls in the scope of the embed user.
I’m looking for a way to update the embed credentials of a user, any idea how to do that ? I cannot recreate the embed user since I want him to keep his personal dashboards but I need to update because
external_user_idfield of the embed credentials.
I cannot construct an SSO url using the new
external_user_idsince it will create a new user.
Hi, according to the second comment
Could you share with me example of API call for python? Now I see empty embedded section after user creation.
if we are trying to embed into a mobile app then it would be nice not to create embed url or use 1x1 iframe, the purpose of embedding (I think) would be to use an external userid etc.