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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
soopicool
New Member

403 forbidden error

 I am trying to embedd my power bi report in wordpress site using "Power BI Embedded".

I am using Azure free account on which I have created the workspace collection, workspace and also imported the report into the workspace.

Now I need to put PHP code in my website for embedding the report before that I need to get "report id", so for that I am using the API request  "Get https://api.powerbi.com/v1.0/collections/[CollectionName]/workspaces/7[workspaceID]/reports".

I am running this request in "Postman" Chrome app to get the http response but it is giving "403 forbidden" error.

 

Please help.

2 REPLIES 2
Eric_Zhang
Microsoft Employee
Microsoft Employee

@soopicool

How did you pass the dev token?

 

 

I have generated the developer token in php and then passed it in javascript code in Iframe with the help of PHP variable.

 

Like this:

<?PHP

 

$apptoken = ....

?>

 

<body>
<button id="btnView">View Report !</button>
<div id="divView">
<iframe id="ifrTile" width="100%" height="400"></iframe>
</div>
<script>
(function () {
document.getElementById('btnView').onclick = function() {
var iframe = document.getElementById('ifrTile');
iframe.src='https://embedded.powerbi.com/appTokenReportEmbed?reportId=2d4210c6-be8b-4bf9-8cd4-134f99a0c1fa';
iframe.onload = function() {
var msgJson = {
action: "loadReport",
accessToken: "<?=$apptoken?>",
height: 500,
width: 722
};
var msgTxt = JSON.stringify(msgJson);
iframe.contentWindow.postMessage(msgTxt, "*");
};
};
}());
</script>
</body>

 

When I debugged the code I found that the token gets generated fine in PHP but when I access PHP variable in javascript code the value is not shown. The value is not transfered from appken to accessToken. 

 

I think some where I am not properly using the PHP variable in javascript.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 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.