Facing issues while embedding my PowerBI report into my react.js application

Hari 0 Reputation points
2024-12-10T11:57:06.3566667+00:00

I am trying to integrate my powerbi report with my react application, and I am not bale to embed my report

Getting error message as : get report failed

things I have done

  1. created a powerbi report in my account(pro licence)
  2. created a application in azure active directory
  3. created a client secret
  4. created a security group and added my service principle account to that security group
  5. added my service principle to my workspace as a admin
  6. made the neccesay changes in admin portal ( I did not found "Allow service principles to use powerbi api" this option in my admin portal tenant settings and I enabled "Service principals can access read-only admin __API__s")
  7. I'm trying to use a Power BI REST API to retrieve info about one of our workspaces. To do this, it's crucial we make use of a Service Principal. So far I've used a POST request in Postman to retrieve the bearer token. To do this I've used the 4 parameters I've seen specified in documentation/other tickets, which are: grant_type, client_id, client_secret, scope. This then outputs a bearer token, which gives me confidence that we've set up the Service Principal correctly and that it's working as it should be: so far so good.
  8. now I have replaced acessToken in my react.js code, then it is showing the following error User's image
  9. I have tried to get information about my workspace and reports that are present in the workspace through api calls in postman and I got those information also, but not able to embed in my react application
  10. and here is my react.js code snippet
      ```javascript
    
    import { PowerBIEmbed } from 'powerbi-client-react'; import { models } from 'powerbi-client'; function Dashboard() { return ( <div> </div> ); } export default Dashboard;
       
    
Microsoft 365
Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
5,537 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,336 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.