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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.