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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
JeremsB
New Member

Unable to get PowerBI Access token from the API

(Newbie to PowerBI)
Hello,

I have a back-end app (NestJS) registered in Azure AD and I want to use it to retrieve a Power BI embed token in order to display some reports on my front-end app (React)

I've followed this tutorial and I use this route to try to get my token
https://api.powerbi.com/v1.0/myorg/groups/*workspaceId*/reports/*reportId* 
In the header I have a Bearer coming from this function

 

 

   const clientCredentialRequest = {
      scopes: ['https://analysis.windows.net/powerbi/api/.default'],
    };

    return this.msalClient.acquireTokenByClientCredential(
      clientCredentialRequest,
    );

 

 

(my msalClient is working well cause I use it for other tasks and I got no problems)

I got this error when trying to retrieve the embed token

 

 

{
    "error": {
        "code": "PowerBINotAuthorizedException",
        "pbi.error": {
            "code": "PowerBINotAuthorizedException",
            "parameters": {},
            "details": [],
            "exceptionCulprit": 1
        }
    }
}

 

 

There is a step in the tutoriel that I think maybe is not good, is the step 7

JeremsB_0-1693819966747.png

I have not this menu on Power BI

The (new) layout is like this

JeremsB_1-1693820066597.png


Also a last idea to solve my pb is about the pricing and the prerequesties to display power bi reports in a react app I have only AAD do I need anything else ?

Thanks in advance

(Sorry for my english, I'm french 🇫🇷)




1 REPLY 1
amitchandak
Super User
Super User

@JeremsB , refer if these can help

https://www.youtube.com/watch?v=N8qYRSqRz84

https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/generate-token

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.