Forum Discussion
Is it possible to use an API Bearer to load a report preauthenticated
- 6 years ago
Hi CamStillHere ,
To summarise the steps for hte implicit grant flow with Power BI Embedded and the REST APIs:
- Prompt the user with an Azure AD account to login with its username and password
- If successfull you have an id_token
- With that id_token you can authenticate to Azure AD together with an application id
- If successfull you have an access_token
- That access_token you can use to upload the report via the Power BI REST APIs
- Use the same access_token as part of the config (together with tokenType: models.TokenType.Aad) with the Power BI Embedded SDK, see https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-spa-overview for more information.
If I understand correctly you have already implemented the first 5 steps and you only need to implement step 6.
-JP
Hi CamStillHere ,
Assuming your users already having PowerBI Pro licenses in that case, you can use the PowerBI Embedded - User owns data
Sample Code for the reference: https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/User%20Owns%20Data
Here you are using PBI JS to embed your pbi reports using the end users bearer token
This is helpful however looks to require IIS?
Is there a way to embedded it for example in an app that only has a browser (and can send headers along with the browser navigate request)
If this does work without IIS/some sort of hosted solution - is there steps?
- Jayendran6 years ago
Solution Sage
Hi
Both App owns data and user owns data require Web Server like IIS
Other option is to use Secure Embed : This option help you to embed in any of the apps (don't need any IIS) there are some limitations
Limitations:
- The user will need to sign-in to view the report whenever they open a new browser window.
- Some browsers require you to refresh the page after sign-in, especially when using InPrivate or InCognito modes.
- To achieve a single sign-on experience, use the Embed in SharePoint Online option, or build a custom integration using the User Owns Data approach. Learn more about User owns data
- The automatic authentication capability provided with the Embed option does not work with the Power BI JavaScript API. For the Power BI JavaScript API, use the User Owns Data approach to embedding. Learn more about User owns data
- Secure embed does not support paginated reports or dashboards.
- Embedding in Portals for Azure B2B users is not yet supported.
Not sure you can override the autentication and provide the bearer token with this option.
- CamStillHere6 years agoRegular Visitor
Thank you! That's a wealth of information.
Unfortunately for me I'm using an application (java) that is using a jxbrowser (embedded browser) so native authentication like sharepoint etc don't work. The user is prompted as if in incognito.
The other feedback is great too.
I'll leave this question open because I'm still wanting to know about using the API bearer token to load the report in some way. If I don't get an answer I'll mark yours as accepted as it's the best I've got in multiple forums so far.
- Jayendran6 years ago
Solution Sage
Hi CamStillHere ,
Do you have any update for your question? I'm happy to hear from you , to close this thread !