<?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 Re: How to obtain an access token utilizing REST API? in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/How-to-obtain-an-access-token-utilizing-REST-API/m-p/3476806#M44925</link>
    <description>&lt;P&gt;Have you completed the app registration including asking for the right scope?&lt;/P&gt;</description>
    <pubDate>Sat, 14 Oct 2023 13:38:01 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2023-10-14T13:38:01Z</dc:date>
    <item>
      <title>How to obtain an access token utilizing REST API?</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-to-obtain-an-access-token-utilizing-REST-API/m-p/3466970#M44847</link>
      <description>&lt;P&gt;I am looking to generate an access token that I can then utilize to edit/create datasets and reports in the power bi service. I came across &lt;A href="https://community.fabric.microsoft.com/t5/Developer/REST-API-Get-Access-Token/m-p/1895937" target="_self"&gt;this link&lt;/A&gt; but after attempting to use it I am getting the below error messages I am having problems resolving.&lt;BR /&gt;&lt;BR /&gt;Can someone point me in the correct direction?&amp;nbsp; Below is the code I've attempted to use and the error messages I am receiving.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DonBot_0-1696860521229.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/978522i236FA95AD5463E75/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DonBot_0-1696860521229.png" alt="DonBot_0-1696860521229.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DonBot_1-1696860562883.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/978523i836392B40D5919DB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DonBot_1-1696860562883.png" alt="DonBot_1-1696860562883.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DonBot_2-1696860749750.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/978525i57BA3B42F618B593/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DonBot_2-1696860749750.png" alt="DonBot_2-1696860749750.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using System;
using Microsoft.IdentityModel.Clients.ActiveDirectory;

namespace walkthrough_push_data
{
    class Program
    {
        private static string token = string.Empty;

        static void Main(string[] args)
        {
            // Get an authentication access token
            token = GetToken();
        }

        private static async Task&amp;lt;string&amp;gt; GetToken()
        {
            string clientID = "{Client_ID}"; // The client id that Azure AD created when you registered your client app.
            string redirectUri = "https://login.live.com/oauth20_desktop.srf"; // RedirectUri you used when you register your app.
            string resourceUri = "https://analysis.windows.net/powerbi/api"; // Resource Uri for Power BI API
            string authorityUri = "https://login.microsoftonline.com/common/"; // OAuth2 authority Uri

            AuthenticationContext authContext = new AuthenticationContext(authorityUri);
            var result = await authContext.AcquireTokenAsync(resourceUri, clientID, new Uri(redirectUri));

            Console.WriteLine(result.AccessToken);
            Console.ReadLine();

            return result.AccessToken;
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Oct 2023 14:20:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-to-obtain-an-access-token-utilizing-REST-API/m-p/3466970#M44847</guid>
      <dc:creator>Don-Bot</dc:creator>
      <dc:date>2023-10-09T14:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to obtain an access token utilizing REST API?</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-to-obtain-an-access-token-utilizing-REST-API/m-p/3476806#M44925</link>
      <description>&lt;P&gt;Have you completed the app registration including asking for the right scope?&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2023 13:38:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-to-obtain-an-access-token-utilizing-REST-API/m-p/3476806#M44925</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-10-14T13:38:01Z</dc:date>
    </item>
  </channel>
</rss>

