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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

403 Error When using POST to receive Report Embedded Token

I created a simple Angular project to access the Power BI API. I am following the workflow of the App Owns The Data. My first POST call received an access token with no issues which is as follows:

(client_id, username, and password data removed from code post)

I am using my account which is the owner of the workspace and the owner of the registered Azure app.

 

//API call to get the access token
      const POSTbody = new HttpParams() 
        .set('client_id','client_id')
        .set('grant_type','password')
        .set('resource','https://analysis.windows.net/powerbi/api')
        .set('username', 'username')
        .set('password', 'password')
      
      this.http.post('https://login.microsoftonline.com/common/oauth2/token',POSTbody).subscribe(
          res => { console.log(res);
            accesstoken = res.access_token;
                 console.log('Access Token: ' + accesstoken)},
          err => { console.error(err); })

The second POST call which is to https://api.powerbi.com/v1.0/myorg/groups/... using the access token from the first API call is returning a 403 (Forbidden). This is the second call:

(access_token contains the token from the first API call, group ID and report ID data removed from code post)

 

var headers = new HttpHeaders();
    headers.append('Authorization','Bearer '+ access_token)

let url = 'https://api.powerbi.com/v1.0/myorg/groups/ID/reports/ID/GenerateToken';
   

      const Embedbody = new HttpParams()   
      .set('accessLevel','View')
      
      this.http.post(url,Embedbody
        ,{headers:headers}).subscribe(
          res => {console.log(access_token)},
          err => {console.log('ERROR!')},
          
      )

I verified in Azure that my registered app as the correct permissions:

Windows Azure Active Directory:

    Access the directory as the signed-in user

    Read all users' basic profiles

    Sign in and read user profile

Power BI Service (Power BI)

    All DELEGATED PERMISSIONS except  View all contet in tenant.

 

 

Has anyone run into this issue before using the API call in an Angular app?

Is there way to receive more details in the 403 error message?

0 REPLIES 0

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.