Forum Discussion
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&[email protected]&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
- LarsNordqvistRegular Visitor
Same issue here. Trying to embed dashboard, seems to render the dashboard but pinned tile is not updated.
Getting same 400 error in consoleSeems 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)
- DMiradakisAdvocate II
I am having the same exact problem right now. Has anyone found a solution?
- Eric_ZhangMicrosoft Employee
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.
- AnonymousNot 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=eyJjbHVzdGVyVXJsIjoiaHR0cHM6Ly9XQUJJLVVLLVNPVVRILUItUFJJTUFSWS1yZWRpcmVjdC5hbmFseXNpcy53aW5kb3dzLm5ldCJ9
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 :
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.
- AnonymousNot applicable
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?