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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
karlrez
Frequent Visitor

Issue running demo react application

I cloned the demo repository at: https://github.com/microsoft/powerbi-client-react

and have not made any code changes.

 

I run "npm run demo" to start the app, and then after clicking "embed report" I am hit with this error:

 

karlrez_1-1730376666392.png

 

2 REPLIES 2
karlrez
Frequent Visitor

Thank you for your reply, I see I can follow the steps to change it to use my own report.

 

The demo repo is setup to embed a demo report from Microsoft. Do you know if there is any workaround to authenticate with this report and avoid the error?

v-yohua-msft
Community Support
Community Support

Hi, @karlrez 

You seem to be experiencing the 403 Forbidden error and CORS policy issue. The 403 error usually indicates a permissions issue, and you need to make sure that the API permissions are set correctly in Azure Active Directory and that you have the appropriate permissions to access the Power BI REST APIs. Also make sure you're using the correct token type. For embedded reports, you should use models. TokenType.Aad if you are embedding for your organization. You can check the following links:

Solved: 403 forbidden error while trying to call power bi ... - Microsoft Fabric Community

 

Solved: Re: Embed report using react-powerbi-client ends w... - Microsoft Fabric Community

 

The CORS policy is wrong because the server does not allow requests from your local development environment. You'll need to check that the server hosting the Power BI report has the correct CORS header set up. This typically involves setting the Access-Control-Allow-Origin header to allow requests from your development environment. For local development, you can use a CORS proxy or browser extension to temporarily bypass CORS restrictions. You can check the following links:

What Is CORS Policy Error in React App and How To Get Rid of It? - Upmostly

 

Understanding CORS Policy Errors and Their Resolutions for React Developers – devgem.io - devgem.io

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.