cancel
Showing results for 
Search instead for 
Did you mean: 

JS Client API calls to load Embedded Report in App Own Data setup returns 401

Hi,

 

We have setup in our organization an application associated with a Service Principal (following those guides: https://docs.microsoft.com/en-us/power-bi/developer/embed-sample-for-customers and https://docs.microsoft.com/en-us/power-bi/developer/embed-service-principal).

 

The backend of the application retrieves an embed token for a report (using https://docs.microsoft.com/en-us/rest/api/power-bi/embedtoken/reports_generatetokeningroup) which is then used by the frontend with the powerbi javascript library (https://www.npmjs.com/package/powerbi-client) to show the report in the user's browser.

 

The problem is that in some specific cases, the API calls made by powerbi-client returns 401 errors, while for other users, with the exact same embed token and report, everything works without problem.

 

We noticed that it happened to the user that had previously logged to powerbi service (https://app.powerbi.com/) using a Free PowerBI Account. If they clear the cookies from their browser for the powerbi.com domain, then everything works as expected.

 

I believe that the API serving the report using embed token should be ignoring any cookie and other identification and only exploit the embed token to validate the request.

Status: Needs Info
Comments
Super Contributor

Hi @victornoel ,

 

Did this problem occur to all web browsers or some specific browsers that users used to log in Power BI Service? It looks like a problem that some browsers might cache your login info which causes conflict with specified token in API.

 

To avoid this behavior, I would suggest those users log in service with a different web browser or open browser in private mode.

 

Best regards,

Yuliana Gu

Super Contributor
Status changed to: Needs Info
 
Visitor

Hi @v-yulgu-msft, thank you for the proposition but we are already aware of this workaround as you can see in the original description.

 

This is a bug and PowerBI service should gracefuly handle those situtations.