<?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 Rest API Access token using OAuth Token in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-Access-token-using-OAuth-Token/m-p/3578354#M45728</link>
    <description>&lt;P&gt;I'm trying to pull data using basic REST API calls, for example,&amp;nbsp;&lt;A href="https://api.powerbi.com/v1.0/myorg/admin/reports" target="_blank" rel="noopener"&gt;https://api.powerbi.com/v1.0/myorg/admin/reports&lt;/A&gt;. When I go through&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/admin/reports-get-reports-as-admin" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/rest/api/power-bi/admin/reports-get-reports-as-admin&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using Alteryx to download and parse the data, and when downloading using the API and getting the bearer token from&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/admin/reports-get-reports-as-admin" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/rest/api/power-bi/admin/reports-get-reports-as-admin&lt;/A&gt;&amp;nbsp;it works and returns the data I need. However, I need to automate this so in my workflow, I want to pull a new access token when I run my workflow to use in any subsequent API calls. So, I have created an app in my azure portal and trying to call&amp;nbsp;&lt;A href="https://login.microsoftonline.com/{tenant" target="_blank" rel="noopener"&gt;https://login.microsoftonline.com/{tenant&lt;/A&gt;&amp;nbsp;id}/oauth2/v2.0/token for my authorization token to use in my get reports apiWhen I use that access token I receive a 403 error. Below is the post call i'm using to get the access token.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I've also tried using login.windows.net and this allowed me to use password as a grant_type and provided both an access and refresh token, yet both of those didn't work as expected.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;My end goal, is to have a workflow that goes and gets the bearer authorization token to use for several calls available here&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Dec 2023 21:09:12 GMT</pubDate>
    <dc:creator>MD39</dc:creator>
    <dc:date>2023-12-11T21:09:12Z</dc:date>
    <item>
      <title>Rest API Access token using OAuth Token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-Access-token-using-OAuth-Token/m-p/3578354#M45728</link>
      <description>&lt;P&gt;I'm trying to pull data using basic REST API calls, for example,&amp;nbsp;&lt;A href="https://api.powerbi.com/v1.0/myorg/admin/reports" target="_blank" rel="noopener"&gt;https://api.powerbi.com/v1.0/myorg/admin/reports&lt;/A&gt;. When I go through&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/admin/reports-get-reports-as-admin" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/rest/api/power-bi/admin/reports-get-reports-as-admin&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using Alteryx to download and parse the data, and when downloading using the API and getting the bearer token from&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/admin/reports-get-reports-as-admin" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/rest/api/power-bi/admin/reports-get-reports-as-admin&lt;/A&gt;&amp;nbsp;it works and returns the data I need. However, I need to automate this so in my workflow, I want to pull a new access token when I run my workflow to use in any subsequent API calls. So, I have created an app in my azure portal and trying to call&amp;nbsp;&lt;A href="https://login.microsoftonline.com/{tenant" target="_blank" rel="noopener"&gt;https://login.microsoftonline.com/{tenant&lt;/A&gt;&amp;nbsp;id}/oauth2/v2.0/token for my authorization token to use in my get reports apiWhen I use that access token I receive a 403 error. Below is the post call i'm using to get the access token.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I've also tried using login.windows.net and this allowed me to use password as a grant_type and provided both an access and refresh token, yet both of those didn't work as expected.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;My end goal, is to have a workflow that goes and gets the bearer authorization token to use for several calls available here&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 21:09:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Rest-API-Access-token-using-OAuth-Token/m-p/3578354#M45728</guid>
      <dc:creator>MD39</dc:creator>
      <dc:date>2023-12-11T21:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: Rest API Access token using OAuth Token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-Access-token-using-OAuth-Token/m-p/3579123#M45736</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="659278" data-lia-user-login="MD39" class="lia-mention lia-mention-user"&gt;MD39&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on my testing, even if you successfully generate an AAD token, the content permissions that your token can access are still determined by the value defined in the scope parameter, so if you want to run the Power BI API, you can try to define and fill in the scope parameter with this value&lt;/P&gt;
&lt;P&gt;&lt;A href="https://analysis.windows.net/powerbi/api/.default" aria-label="Link https://analysis.windows.net/powerbi/api/.default" target="_blank"&gt;https://analysis.windows.net/powerbi/api/.default&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;At the same time, you can also make sure that the required scope of the application used to generate the token has been filled in using the delegated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 07:08:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Rest-API-Access-token-using-OAuth-Token/m-p/3579123#M45736</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-12-12T07:08:00Z</dc:date>
    </item>
  </channel>
</rss>

