Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
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:
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?
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.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
86 | |
85 | |
84 | |
67 | |
49 |
User | Count |
---|---|
131 | |
110 | |
97 | |
71 | |
67 |