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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
milangarg
Regular Visitor

powerBI embedded : embeding report using javascript API

Hi 

 

We have uploaded .pbix reports to workspaces on azure

We are generating a accesskey at run time and passing the values in a JSON format to PowerBI Angular SDK

 

But when the API tries to load the report it gets the following error

 

https://wabi-south-east-asia-redirect.analysis.windows.net/metadata/cluster 401 (Unauthorized)

 

Our Azure account is in South Central US  

 

Any help would be appreciated

 

 

we are sending all the values back from our .NET MVC controller to our HTML page as show below

var embedConfiguration = {
    type: 'report',
    accessToken: 'eyJ0eXAiO...Qron7qYpY9MI',
    id: '5dac7a4a-4452-46b3-99f6-a25915e0fe55',
    embedUrl: 'https://embedded.powerbi.com/appTokenReportEmbed'
};
var $reportContainer = $('#reportContainer');
var report = powerbi.embed($reportContainer.get(0), embedConfiguration);
3 REPLIES 3
milangarg
Regular Visitor

I tried using the report id in the sample provided with the following code

@model ProvisionPower.Models.UserLogin
@{
Layout = null;
ViewBag.Title = "SignIn | Helios Data";
}

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>

<meta name="description" content="User login page" />


<!--<script src="https://npmcdn.com/powerbi-client@2.0.0"></script>-->
<!--<script src="https://npmcdn.com/angular-powerbi@1.0.0"></script>-->



</head>

<body>
<!-- <div powerbi-type="report"
powerbi-access-token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXIiOiIwLjIuMCIsIndjbiI6IkFDTUUtQ29ycG9yYXRpb24iLCJ3aWQiOiJiZTFjMjUzZi02NTliLTQ5MjUtODE5ZS0xODhlNDhjYWU0ZDYiLCJyaWQiOiI3ODI1ZTE2ZC1iMDk3LTQzZmUtOTg2ZC1mYjQ5Mjg4NmU4MjkiLCJpc3MiOiJQb3dlckJJU0RLIiwiYXVkIjoiaHR0cHM6Ly9hbmFseXNpcy53aW5kb3dzLm5ldC9wb3dlcmJpL2FwaSIsImV4cCI6MTQ3NDA0NTg5OSwibmJmIjoxNDc0MDQyMjk5fQ.BBowpDOenhf-IUX7DlGut2Bzel7V1JuqpYXMw3p5pP0"
powerbi-report-id="7825e16d-b097-43fe-986d-fb492886e829"
powerbi-embed-url="https://embedded.powerbi.com/appTokenReportEmbed">
</div>-->
<div id="reportContainer2"></div>

<div id="reportContainer3" ></div>

<script src="~/Scripts/powerbi.js"></script>
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Scripts/fetch.js"></script>
<script src="~/Scripts/es6-promise.js"></script>

<script>

var allReportsUrl = 'https://powerbiembedapi.azurewebsites.net/api/reports/c52af8ab-0468-4165-92af-dc39858d66ad';
var $dynamicReportContainer = $('#reportContainer2');
fetch(allReportsUrl)
.then(function (response) {
if (response.ok) {
return response.json()
.then(function (embedConfig) {
return powerbi.embed($dynamicReportContainer.get(0), embedConfig);
});
}
else {
return response.json()
.then(function (error) {
throw new Error(error);
});
}
});

 



</script>
</body>
</html>

 

still I get redirected to the south east cluster and I get an error message 403

 

I then tried embeding my report using the following code

 

var embedConfiguration = {
type: 'report',
accessToken: '3aW5kb3dzLm5ldC9wb3dlcmJpL2FwaSIsImV4cCI6MTQ3NDIwMTc4NiwibmJmIjoxNDc0MTk4MTg2fQ.rWqR3hSqieMAeAjxPcTnHfwJkuP2-X2G9FBt08o9R5w',
id: '7825e16d-b097-43fe-986d-fb492886e829',
webUrl:"https://app.powerbi.com/reports/7825e16d-b097-43fe-986d-fb492886e829",
embedUrl: 'https://embedded.powerbi.com/appTokenReportEmbed?reportId=7825e16d-b097-43fe-986d-fb492886e829'
};
var $reportContainer = $('#reportContainer2');
var report = window.powerbi.embed($reportContainer.get(0), embedConfiguration);

 

Still I get the same error 403 

 

Kindly help

 

@milangarg,

 

I know there is a demo about how to consume Power BI API and render using angular components, as well as its source https://github.com/Azure-Samples/powerbi-angular-client. You may also reach out for help there.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@milangarg

 

Could you solve the issue? I am also facing same error. Any idea how to solve it?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.