<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic 403 Error When using POST to receive Report Embedded Token in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/403-Error-When-using-POST-to-receive-Report-Embedded-Token/m-p/385832#M11458</link>
    <description>&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;(client_id, username, and password data removed from code post)&lt;/P&gt;&lt;P&gt;I am using my account which is the owner of the workspace and the owner of the registered Azure app.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;//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 =&amp;gt; { console.log(res);
            accesstoken = res.access_token;
                 console.log('Access Token: ' + accesstoken)},
          err =&amp;gt; { console.error(err); })&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;The second POST call which is to &lt;A href="https://api.powerbi.com/v1.0/myorg/groups/" target="_blank"&gt;https://api.powerbi.com/v1.0/myorg/groups/&lt;/A&gt;... using the access token from the first API call is returning a 403 (&lt;/SPAN&gt;&lt;SPAN&gt;Forbidden). This is the second call:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(access_token contains the token from the first API call, group ID and report ID data removed from code post)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;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 =&amp;gt; {console.log(access_token)},
          err =&amp;gt; {console.log('ERROR!')},
          
      )&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;I verified in Azure that my registered app as the correct permissions:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Windows Azure Active Directory:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; Access the directory as the signed-in user&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; Read all users' basic profiles&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; Sign in and read user profile&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Power BI Service (Power BI)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; All DELEGATED PERMISSIONS except&amp;nbsp; View all contet in tenant.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Has anyone run into this issue before using the API call in an Angular app?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there way to receive more details in the 403 error message?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Mar 2018 18:44:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-03-28T18:44:05Z</dc:date>
    <item>
      <title>403 Error When using POST to receive Report Embedded Token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/403-Error-When-using-POST-to-receive-Report-Embedded-Token/m-p/385832#M11458</link>
      <description>&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;(client_id, username, and password data removed from code post)&lt;/P&gt;&lt;P&gt;I am using my account which is the owner of the workspace and the owner of the registered Azure app.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;//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 =&amp;gt; { console.log(res);
            accesstoken = res.access_token;
                 console.log('Access Token: ' + accesstoken)},
          err =&amp;gt; { console.error(err); })&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;The second POST call which is to &lt;A href="https://api.powerbi.com/v1.0/myorg/groups/" target="_blank"&gt;https://api.powerbi.com/v1.0/myorg/groups/&lt;/A&gt;... using the access token from the first API call is returning a 403 (&lt;/SPAN&gt;&lt;SPAN&gt;Forbidden). This is the second call:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(access_token contains the token from the first API call, group ID and report ID data removed from code post)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;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 =&amp;gt; {console.log(access_token)},
          err =&amp;gt; {console.log('ERROR!')},
          
      )&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;I verified in Azure that my registered app as the correct permissions:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Windows Azure Active Directory:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; Access the directory as the signed-in user&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; Read all users' basic profiles&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; Sign in and read user profile&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Power BI Service (Power BI)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; All DELEGATED PERMISSIONS except&amp;nbsp; View all contet in tenant.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Has anyone run into this issue before using the API call in an Angular app?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there way to receive more details in the 403 error message?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 18:44:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/403-Error-When-using-POST-to-receive-Report-Embedded-Token/m-p/385832#M11458</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-28T18:44:05Z</dc:date>
    </item>
  </channel>
</rss>

