Powerbi Report Not working, Access Token related - powerbi

I got a problem that prevents me from moving forward. I want to embed Power BI report into my own web application. I am following the "embed for your customers" scenario with the master user option.
I struggle to embed the report in my web app. Where the report should be displayed, power BI API returns a "this content isn't available". I am wondering if it has something to do with the access token.
How to generate an access token for each user connecting to my web app to see the report? I am using react to build my web app.

Related

Power BI Report Server Embedding & Silent Authentication

I am trying to silently authenticate the embeded report like done in Power BI Service. However in Report Server embedding is available through iframe and user is prompted to login with Windows/NTLM account. How can I authenticate silently like done in cloud based approach with a master user ?
So here is how I solved this issue for anyone wondering.
I wrote a reverse proxy to Power BI Reporting Server in my .Net Core application and authenticated each request with BASIC. I needed to enable BASIC authentication and CORS from application URL. (also you may need to add Network Service as content manager/viewer to your report)
Here are some useful links:
Proxy
PBIRS CORS

PowerBI Secure Embed on webpage and connect powerbi from backend

Hi I'm Using PowerBI Pro version. I have 10 clients and created all their dashboards on my single PowerBI account. I have custom login page where each client can login to their private space and see their dashboard and here I have pasted the secure embed code generated from PowerBI.
It is secure coz it asks to login to powerbi but I cant give my PowerBI account credentials to the client, If I do they is a possibility they can go to PowerBI login page and login using my credentials and see the other 9 clients dashboards and reports.
Is there any way to connect powerbi from code so i can login from my code itself and they can only see the dashboard of their own?
Yes, you need to embed these dashboards and reports into your application, using app owns data scenario.
How to do this is asked many times. See for example Is there any way to embed power bi reports and dashboards in vb.net or C# desktop application with sql server 2008 database?

Embedding Power BI reports in to Angular application

I am trying to embed a Power BI reports in to our Angular application. We are currently using Identity server to authenticate and get the security token back from Azure Active Directory. Can that token be used in embedding the Power BI reports in to our application or is it mandatory to register a application in azure which will help in embedding reports
You must register an application to establish an identity for your application and specify permissions. Both the access token and the app ID are used when embedding Power BI elements into your application. It is recommended for the actual embedding to also use embed token generated by GenerateTokenInGroup or similar, because the authentication token will be exposed in JavaScript client code of your application and can be seen. AAD tokens can be exploited to call other REST API functions, etc., while embed tokens are valid only for embedding this one element only and expires in less time.
For detailed information how to embed Power BI see Embed reports or dashboards from apps.
To embed Power BI without registering an application, you can use Publish to web or Embed. The first one will give public access to everyone who knows the link (note it has some limitations), while for the second option each user will need Pro account, unless you are using Power BI Premium or Embedded (and note its limitations too).

How to remove the signin page from the report when Power BI report is embedded into Web Application using Secure Embed Option

I have a web application in which Azure Active Directory authentication is implemented.
Now I am embedded my Power BI reports in this Web Application using Secure Embed Option.
Whenever a user logs into the web application, he sees a separate sign in button on the Power BI reports after successful login into Web Application.
Is there a way to automatically signin into Power BI reports using the currently logged in user.
Currently logged in user has access to both Azure AD as well as Power BI.
Secure embed option is used to embed a report in a given iframe where every user would need to sign-in within the iframe.
In order to provide a single sign-on experience, you would need to use the user login authentication to generate an access token.
Generating access tokens -
C# - https://learn.microsoft.com/en-us/power-bi/developer/get-azuread-access-token
JS - (Using ADAL) https://github.com/AzureAD/azure-activedirectory-library-for-js
This access token can then be used to embed reports within an HTML container (for example, a div element) using the Power BI embedded JS library.
When the token is created as per the different users logging in, then such implementation is called as 'User Owns Data'.
Sample code and summary - https://learn.microsoft.com/en-us/power-bi/developer/embed-sample-for-your-organization
Embed setup tool for user owns data: https://app.powerbi.com/embedsetup/UserOwnsData

Power BI embedded - Publishing to Azure Workspace - Issue

As said in many reference link, in case of embedding the power bi to a application where we are going to build a secure website, we need to embed the Power BI report by publishing the power bi report to Azure Workspace right.
In that case , for registering the power bi report in Azure AD we followed the steps specified in the below link
https://azure.microsoft.com/en-in/documentation/articles/power-bi-embedded-iframe/
While trying to import the .pbix file using REST API by using the POST request to api.powerbi.com, we were receiving 403 error. Hence we were not able to proceed further with the registeration/upload of PBIX file using Import API.
Also, for standalone or anonymous public embedding website we can go with Power BI Publish to Web option, using this we can get the embed code for the power bi report, which can be embedded into the web page. In case of standalone reports we can use this option to embed the power bi report on to our application, but since in our requirement we need to filter the data based on the user selection on the custom web page, we have to go with option 1 i.e. with publishing the report to AAD (Azure AD). Since we are facing authentication issue, we are unable to proceed with the process further.
Once the report is being publish we havethought of using either Power BI JavaScript or Angular JS API to pass the filter data from custom filter pane to the power BI as shown in the demo site.