<?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 access token in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/304626#M8970</link>
    <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/6971"&gt;@Eric_Zhang&lt;/a&gt;, thanks a lot. solved the problem.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Nov 2017 09:19:59 GMT</pubDate>
    <dc:creator>mahmoodtahir</dc:creator>
    <dc:date>2017-11-16T09:19:59Z</dc:date>
    <item>
      <title>Cannot get access token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/302106#M8902</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I’m trying to integrate Power BI into my application. I’m trying to get access token from Azure directory using my Acure account.&lt;BR /&gt;&lt;BR /&gt;One of MS Employee has uploaded this code. I just updated configurations (clientID) and it’s not working&lt;BR /&gt;&lt;A href="https://github.com/guyinacube/Embed-API-Sample" target="_blank"&gt;https://github.com/guyinacube/Embed-API-Sample&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I’ve also tried this code but have the same issue&lt;BR /&gt;&lt;A href="https://github.com/Microsoft/PowerBI-Developer-Samples" target="_blank"&gt;https://github.com/Microsoft/PowerBI-Developer-Samples&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{"error":"invalid_grant","error_description":"AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password\r\nTrace ID: 4aa2b383-6a83-4052-91f0-021a8ff72300\r\nCorrelation ID: 25b0177d-8cd1-457f-9909-87f1f8a0b8bc\r\nTimestamp: 2017-11-13 14:41:58Z","error_codes":[70002,50126],"timestamp":"2017-11-13 14:41:58Z","trace_id":"4aa2b383-6a83-4052-91f0-021a8ff72300","correlation_id":"25b0177d-8cd1-457f-9909-87f1f8a0b8bc"}: Unknown error&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 14:51:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/302106#M8902</guid>
      <dc:creator>mahmoodtahir</dc:creator>
      <dc:date>2017-11-13T14:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get access token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/302214#M8909</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/46807"&gt;@mahmoodtahir&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check this link&amp;nbsp;&lt;A href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-register-app/" target="_blank"&gt;https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-register-app/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It seems like you didn't Grant Permissions to your app&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 16:42:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/302214#M8909</guid>
      <dc:creator>Juramirez</dc:creator>
      <dc:date>2017-11-13T16:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get access token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/302253#M8911</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/41885"&gt;@Juramirez&lt;/a&gt;&amp;nbsp;for your reply&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use "User Owns Data" example then i&amp;nbsp;can access token and able to embed dashboard&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but If I use same registered app (in azure) with "App Owns Data" example then i get this issue.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 17:47:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/302253#M8911</guid>
      <dc:creator>mahmoodtahir</dc:creator>
      <dc:date>2017-11-13T17:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get access token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/302263#M8912</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/46807"&gt;@mahmoodtahir&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use AOD and the problem you're getting I solved it doing that. Please be sure you're following all steps in&amp;nbsp;&lt;A href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-embed-sample-app-owns-data/&amp;nbsp;" target="_blank"&gt;https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-embed-sample-app-owns-data/&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Did you change your web config parameters?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 18:13:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/302263#M8912</guid>
      <dc:creator>Juramirez</dc:creator>
      <dc:date>2017-11-13T18:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get access token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/303542#M8941</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/46807"&gt;@mahmoodtahir&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I’m trying to integrate Power BI into my application. I’m trying to get access token from Azure directory using my Acure account.&lt;BR /&gt;&lt;BR /&gt;One of MS Employee has uploaded this code. I just updated configurations (clientID) and it’s not working&lt;BR /&gt;&lt;A href="https://github.com/guyinacube/Embed-API-Sample" target="_blank"&gt;https://github.com/guyinacube/Embed-API-Sample&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I’ve also tried this code but have the same issue&lt;BR /&gt;&lt;A href="https://github.com/Microsoft/PowerBI-Developer-Samples" target="_blank"&gt;https://github.com/Microsoft/PowerBI-Developer-Samples&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{"error":"invalid_grant","error_description":"AADSTS70002: Error validating credentials. AADSTS50126: &lt;STRONG&gt;Invalid username or password&lt;/STRONG&gt;\r\nTrace ID: 4aa2b383-6a83-4052-91f0-021a8ff72300\r\nCorrelation ID: 25b0177d-8cd1-457f-9909-87f1f8a0b8bc\r\nTimestamp: 2017-11-13 14:41:58Z","error_codes":[70002,50126],"timestamp":"2017-11-13 14:41:58Z","trace_id":"4aa2b383-6a83-4052-91f0-021a8ff72300","correlation_id":"25b0177d-8cd1-457f-9909-87f1f8a0b8bc"}: Unknown error&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/46807"&gt;@mahmoodtahir&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;The error message is intuitive. What is the account and password in your App Owns Data sample? Can you confirem that account is a valid Power BI account?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 07:38:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/303542#M8941</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-11-15T07:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get access token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/303709#M8943</link>
      <description>&lt;P&gt;Hi, yes it is valid power bi account and azure account (for both portals i've same email address)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if i use "User Owns Data" application, then i can&amp;nbsp;get access token and see dashboards and everything&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Microsoft/PowerBI-Developer-Samples" target="_blank"&gt;https://github.com/Microsoft/PowerBI-Developer-Samples&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but if i use "App Owns Data" code then i get following error message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;&lt;I&gt;{"error":"invalid_client","error_description":"AADSTS70002: The request body must contain the following parameter: 'client_secret or client_assertion'.\r\nTrace ID: 1cd4832f-7748-4e25-92f3-bedc7c871700\r\nCorrelation ID: 2caf178e-af91-4d8d-86ca-2601f6813a0f\r\nTimestamp: 2017-11-15 09:54:08Z","error_codes":[70002],"timestamp":"2017-11-15 09:54:08Z","trace_id":"1cd4832f-7748-4e25-92f3-bedc7c871700","correlation_id":"2caf178e-af91-4d8d-86ca-2601f6813a0f"}: Unknown error&lt;/I&gt;&lt;/H2&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;I&gt;FYI:&lt;/I&gt;&lt;/P&gt;&lt;P&gt;If I hard code access token in "App Owns Data" then I can get all reports. As you know I can't hard code token it expires in an hour. (10mins to 1 day validity)&lt;/P&gt;&lt;P&gt;&lt;I&gt;string accessToken = "ACCESS TOKEN";&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;var tokenCredentials = new TokenCredentials(accessToken, "Bearer");&lt;BR /&gt;using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))&lt;BR /&gt;{&lt;BR /&gt;// Get a list of reports.&lt;BR /&gt;var reports = await client.Reports.GetReportsAsync();&lt;BR /&gt;}&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 10:05:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/303709#M8943</guid>
      <dc:creator>mahmoodtahir</dc:creator>
      <dc:date>2017-11-15T10:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get access token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/304585#M8963</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/46807"&gt;@mahmoodtahir&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi, yes it is valid power bi account and azure account (for both portals i've same email address)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if i use "User Owns Data" application, then i can&amp;nbsp;get access token and see dashboards and everything&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/Microsoft/PowerBI-Developer-Samples" target="_blank"&gt;https://github.com/Microsoft/PowerBI-Developer-Samples&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but if i use "App Owns Data" code then i get following error message&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;&lt;I&gt;{"error":"invalid_client","error_description":"AADSTS70002: The request body must contain the following parameter: 'client_secret or client_assertion'.\r\nTrace ID: 1cd4832f-7748-4e25-92f3-bedc7c871700\r\nCorrelation ID: 2caf178e-af91-4d8d-86ca-2601f6813a0f\r\nTimestamp: 2017-11-15 09:54:08Z","error_codes":[70002],"timestamp":"2017-11-15 09:54:08Z","trace_id":"1cd4832f-7748-4e25-92f3-bedc7c871700","correlation_id":"2caf178e-af91-4d8d-86ca-2601f6813a0f"}: Unknown error&lt;/I&gt;&lt;/H2&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;FYI:&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;If I hard code access token in "App Owns Data" then I can get all reports. As you know I can't hard code token it expires in an hour. (10mins to 1 day validity)&lt;/P&gt;
&lt;P&gt;&lt;I&gt;string accessToken = "ACCESS TOKEN";&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;var tokenCredentials = new TokenCredentials(accessToken, "Bearer");&lt;BR /&gt;using (var client = new PowerBIClient(new Uri(ApiUrl), tokenCredentials))&lt;BR /&gt;{&lt;BR /&gt;// Get a list of reports.&lt;BR /&gt;var reports = await client.Reports.GetReportsAsync();&lt;BR /&gt;}&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/46807"&gt;@mahmoodtahir&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;The error message is different from the error in your original post. In this post, the error indicates that you're using a server-wide application, please register a &lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/register-app" target="_self"&gt;native app&lt;/A&gt; instead.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2017 08:41:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/304585#M8963</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-11-16T08:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot get access token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/304626#M8970</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/6971"&gt;@Eric_Zhang&lt;/a&gt;, thanks a lot. solved the problem.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2017 09:19:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Cannot-get-access-token/m-p/304626#M8970</guid>
      <dc:creator>mahmoodtahir</dc:creator>
      <dc:date>2017-11-16T09:19:59Z</dc:date>
    </item>
  </channel>
</rss>

