Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi,
I am embedding a power BI report using the Javascript API.
The application is a jQuery and Javascript front-end and using a WCF Rest API.
I do the authentication in the Rest API, no integrated domain authentication, and it works as I am getting an access token,
which I then pass back to the front-end.
This has been working just fine, until yesterday when I started getting the below errors on the client (using Chrome).
Nothing changed on my end.
Herewith is my embed code:
_accessToken is the object I got frm mny Rest API with the auth token.
var embedUrl = "https://app.powerbi.com/reportEmbed?reportId=" + _accessToken.reportid + "&groupId=" + _accessToken.groupid;
var models = window['powerbi-client'].models;
var config = {
type: 'report',
accessToken: _accessToken.token,
embedUrl: embedUrl
, settings: {
filterPaneEnabled: false,
navContentPaneEnabled: true,
background: models.BackgroundType.Transparent
}
};
// Grab the reference to the div HTML element that will host the report.
var reportContainer = document.getElementById('dashboard-content');
// Embed the report and display it within the div container.
var report = powerbi.embed(reportContainer, config);
And here is the C# to get the access token
Dictionary<string, object> tokendata = new Dictionary<string, object>();
try {
var credential = new UserPasswordCredential(PowerBIUsr,PowerBIPwd);
// Authenticate using created credentials
var authenticationContext = new AuthenticationContext("https://login.windows.net/common/oauth2/authorize/");
var authenticationResult = await Task.Run(() => authenticationContext.AcquireTokenAsync("https://analysis.windows.net/powerbi/api", PowerBIClientId.ToString(), credential));
if (authenticationResult == null) {
tokendata.Add("error", "{athfailed}");
} else {
tokendata.Add("reportid", this.Settings.PowerBIRepId);
tokendata.Add("groupid", this.Settings.PowerBIGrpId);
tokendata.Add("clientid", this.Settings.PowerBIClientId);
tokendata.Add("token", authenticationResult.AccessToken);
tokendata.Add("tokentype", authenticationResult.AccessTokenType);
tokendata.Add("tokenexpiry", authenticationResult.ExpiresOn);
}
} catch (Exception ex) {
tokendata.Add("error", "{athfailed}");
tokendata.Add("errorO", ex);
}
this.TokenData = tokendata;
Any help will be much appreciated
Kind regards
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |