Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
calm1kov
Regular Visitor

Dashboard embed. Requests with 401

 

Hi,

 

 

I've successfully embeded dathboard in web app for non power-bi users.

 

1. Retrieved access token by password grant type:

 

 

POST /common/oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded

grant_type=password&username=user@domain.onmicrosoft.com&password=123456&client_id=asd123-asd345-asd456&resource=https://analysis.windows.net/powerbi/api

 

 

2. Retrieved dashboard token

 

POST /v1.0/myorg/groups/asd123-asd5556-asdasd564/dashboards/asd345-asd789-asd456/GenerateToken HTTP/1.1
Host: api.powerbi.com
Content-Type: application/json; charset=utf-8
Authorization: Bearer ayJ0eXZAiOiJKX1QiLCJhbGciO...

{"accessLevel": "View"}

3. Embeded with JS in client

 

     // Read embed application token from Model
    var accessToken = "<?=$dashboard_token_data['token']?>";

    // Read dashboard Id from Model
    var embedDashboardId = "<?=$dashboard_id?>";

    // Read embed URL from Model
    var embedUrl = 'https://app.powerbi.com/dashboardEmbed';

    // Get models. models contains enums that can be used.
    var models = window['powerbi-client'].models;

    // Embed configuration used to describe the what and how to embed.
    // This object is used when calling powerbi.embed.
    // This also includes settings and options such as filters.
    // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
    var config = {
        type: 'dashboard',
        tokenType: models.TokenType.Embed,
        accessToken: accessToken,
        embedUrl: embedUrl,
        id: embedDashboardId
    };

    // Get a reference to the embedded dashboard HTML element
    var dashboardContainer = $('#dashboardContainer')[0];

    // Embed the dashboard and display it within the div container.
    var dashboard = powerbi.embed(dashboardContainer, config);

 

 

Dashboard loads and get updates but following requests failed with 401:

 

Failed to load resource: the server responded with a status of 401 (Unauthorized)wabi-west-europe-redirect.analysis.windows.net/powerbi/metadata/user/activedashboard/947870
Failed to load resource: the server responded with a status of 401 (Unauthorized)wabi-west-europe-redirect.analysis.windows.net/powerbi/metadata/models/718093/?modelOptions=Default&packageId=1278570
Failed to load resource: the server responded with a status of 401 (Unauthorized)wabi-west-europe-redirect.analysis.windows.net/powerbi/metadata/models/718093/?modelOptions=Default&packageId=1278570

 

 

Seems that it's doesn't affect functionality for now. Just wandering what might be the cause.

6 REPLIES 6
DMiradakis
Advocate II
Advocate II

I am having the same exact problem right now. Has anyone found a solution?

LarsNordqvist
Regular Visitor

Same issue here. Trying to embed dashboard, seems to render the dashboard but pinned tile is not updated.
Getting same 400 error in console

LarsNordqvist_0-1642859160867.png

LarsNordqvist_1-1642859193745.png

Seems like 'loaded' event is triggered but not 'rendered' or 'error'.

Has anyone got Tiles to update in a embeded dashboard. Works fine from app.powerbi.com (using push dataset)

Eric_Zhang
Employee
Employee

@calm1kov

I can confirm the 401 errors when embedding reports or dashboards. However the reports/dashboards can be rendered without problem.

 

Besides embedding, even when I access Power BI.com and view my reports, I would see 40x and 50x errors in the console as well. I'd guess it is something wrong with the Power BI azure structure, however as long as  those errors don't affect my reports, I just leave them alone.

 

 

For more clarification, I think you can submit a support ticket.

Anonymous
Not applicable

HI 

 

I am getting a same error Failed to load resource: the server responded with a status of 401 when I try to open dashboard URL in new tab https://app.powerbi.com/dashboardEmbed?dashboardId=100114d8-9c7c-4ae1-b1d5-291603b4f22c&config=eyJjb...

 

It works fine on localhost sample dashboard app (C# visual studio 2017)

I am also getting this error on console for https://api.powerbi.com/powerbi/metadata/refreshusermetadata

When i open this link it shows message. See the screenshot below :

 

service.png

 

The dashboard URL should also work on a new tab too because I want to use this link into another website 

 

Please help me, I am trying to find a solution for this now for two days.

 

Thanks in advance.

I am going through the same issue here.. getting 

 

powerbi/metadata/refreshusermetadata 400 error when trying to embed a dashboard.

Reports load just fine.

 

Did anyone figure out the solution for this?

We are facing the same problem, we have an open support ticket with Microsoft. This only started occurring for us last week where dashbaord tiles no longer update for embedded dashboards, but continue to work correctly inside the Power BI service.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.