<?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: Cannot get PowerBI Access token in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-PowerBI-Access-token/m-p/539767#M16686</link>
    <description>&lt;P&gt;Are you using a Azure AD application which is registered as a Native client as opposed to Web app / API. The Native client is the only type of that supports the Password credential flow. This might not be the issue but I thought I would call it out just in case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Oct 2018 11:29:12 GMT</pubDate>
    <dc:creator>TedPattison</dc:creator>
    <dc:date>2018-10-11T11:29:12Z</dc:date>
    <item>
      <title>Cannot get PowerBI Access token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-PowerBI-Access-token/m-p/538676#M16638</link>
      <description>&lt;P&gt;Here's the error I get while trying to get the access token.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{
"error": "invalid_grant",
"error_description": "AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password\r\nTrace ID: a34fb8ab-1026-4120-9d50-623a848b1600\r\nCorrelation ID: cbe5596a-d438-4807-be82-36769aefafe7\r\nTimestamp: 2018-10-10 13:47:30Z",
"error_codes": [70002, 50126],
"timestamp": "2018-10-10 13:47:30Z",
"trace_id": "a34fb8ab-1026-4120-9d50-623a848b1600",
"correlation_id": "cbe5596a-d438-4807-be82-36769aefafe7"
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using ASP.NET Core to embed the power bi report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my code for reference:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;private static async Task&amp;lt;OAuthResult&amp;gt; AuthenticateAsync()
        {
            var oauthEndpoint = new Uri(AuthorityUrl);

            using (var client = new HttpClient())
            {
                var result = await client.PostAsync(oauthEndpoint, new FormUrlEncodedContent(new[]
                {
            new KeyValuePair&amp;lt;string, string&amp;gt;("resource", ResourceUrl),
            new KeyValuePair&amp;lt;string, string&amp;gt;("client_id", ClientId),
            new KeyValuePair&amp;lt;string, string&amp;gt;("grant_type", "password"),
            new KeyValuePair&amp;lt;string, string&amp;gt;("username", Username),
            new KeyValuePair&amp;lt;string, string&amp;gt;("password", Password),
            new KeyValuePair&amp;lt;string, string&amp;gt;("scope", "openid"),
        }));

                var content = await result.Content.ReadAsStringAsync();
                return JsonConvert.DeserializeObject&amp;lt;OAuthResult&amp;gt;(content);
            }
        }

        class OAuthResult
        {
            [JsonProperty("token_type")]
            public string TokenType { get; set; }
            [JsonProperty("scope")]
            public string Scope { get; set; }
            [JsonProperty("experies_in")]
            public int ExpiresIn { get; set; }
            [JsonProperty("ext_experies_in")]
            public int ExtExpiresIn { get; set; }
            [JsonProperty("experies_on")]
            public int ExpiresOn { get; set; }
            [JsonProperty("not_before")]
            public int NotBefore { get; set; }
            [JsonProperty("resource")]
            public Uri Resource { get; set; }
            [JsonProperty("access_token")]
            public string AccessToken { get; set; }
            [JsonProperty("refresh_token")]
            public string RefreshToken { get; set; }
        }&lt;/PRE&gt;&lt;P&gt;I'm using the same username and password and the same client ID for my&amp;nbsp;MVC application and I get the token.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Oct 2018 13:52:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-PowerBI-Access-token/m-p/538676#M16638</guid>
      <dc:creator>MAK89</dc:creator>
      <dc:date>2018-10-10T13:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get PowerBI Access token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-PowerBI-Access-token/m-p/539767#M16686</link>
      <description>&lt;P&gt;Are you using a Azure AD application which is registered as a Native client as opposed to Web app / API. The Native client is the only type of that supports the Password credential flow. This might not be the issue but I thought I would call it out just in case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 11:29:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-PowerBI-Access-token/m-p/539767#M16686</guid>
      <dc:creator>TedPattison</dc:creator>
      <dc:date>2018-10-11T11:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get PowerBI Access token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-PowerBI-Access-token/m-p/540176#M16711</link>
      <description>&lt;P&gt;Yes I'm using an Azure AD app registration of type "Native" in this case.&amp;nbsp; Also, I'm using .NET Core 2.0 app.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 19:22:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-PowerBI-Access-token/m-p/540176#M16711</guid>
      <dc:creator>MAK89</dc:creator>
      <dc:date>2018-10-11T19:22:42Z</dc:date>
    </item>
  </channel>
</rss>

