Forum Discussion
power Bi embed dashboard data doesnt appear outside power bi web
Hi,
i 'm refreshing access token in my dashboard every 59 minutes and also when my application is starting,
Generating credentials and accestoken in backend with c# and embeding it with javascript.
c# service
var credential = new UserPasswordCredential(User, Password);
// Authenticate using created credentials
var authenticationContext = new AuthenticationContext(AuthorityUrl);
var authenticationResult = await authenticationContext.AcquireTokenAsync(ResourceUrl, ClientId, credential);
var tokenCredentials = new TokenCredentials(authenticationResult.AccessToken, "Bearer");
var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials);
var dashboards = await client.Dashboards.GetDashboardsInGroupAsync(GroupId);
var dashboard = dashboards.Value.FirstOrDefault(x => x.Id == DashboardId);
var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view");
var tokenResponse = await client.Dashboards.GenerateTokenInGroupAsync(GroupId, dashboard.Id, generateTokenRequestParameters);
var embedConfig = new EmbedConfig
{
EmbedToken = tokenResponse,
EmbedUrl = dashboard.EmbedUrl,
Id = dashboard.Id
};
return embedConfig;
javascript:
var models = window['powerbi-client'].models;
var permissions = models.Permissions.All;
var config = {
type: 'dashboard',
tokenType: models.TokenType.Embed,
accessToken: data.EmbedToken.Token,
embedUrl: data.EmbedUrl,
id: data.Id,
permissions: permissions,
settings: {
filterPaneEnabled: true,
navContentPaneEnabled: true
}
};
var dashboardContainer = $('#embbedDashboard')[0];
dashboard = powerbi.embed(dashboardContainer, config);
dashboard.off("loaded");
Does the dashboard show correctly when you refresh the page with the dashboard?
You code is accessing the first dashboard in the target workspace. Is it possible you added a new dashbaord which is being access instead of the dashboard you had last Friday?
- cdemiguel7 years agoRegular Visitor
Hello,
when i refresh webpage i see the same dashboard, iframe loaded but not datalayers or contents loaded,
i didnt change anything about code in my workspace, iframe is loading but... i think something is happening with permissions...
the only errors i am seeing are:
wabi-north-europe-redirect.analysis.windows.net/powerbi/metadata/models/4893449/?modelOptions=Default:1 Failed to load resource: the server responded with a status of 401 (Unauthorized)
thanks,