Forum Discussion
Is it possible to use an API Bearer to load a report preauthenticated
I have a rest application with Power BI. I upload a dataset and generate a report.
After the report is uploaded I would like to show the user the report. They have already authenticated to use my REST code... and I have that bearer. Is there any way to show the report without prompting the user to authenticate again?
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
11 Replies
- Jayendran
Solution Sage
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
- CamStillHereRegular Visitor
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?
- Jayendran
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.