<?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 Power BI Embed error in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-error/m-p/526419#M16202</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am embedding a power BI report using the Javascript API.&lt;BR /&gt;The application is a jQuery and Javascript front-end and using a WCF Rest API.&lt;BR /&gt;I do the authentication in the Rest API, no integrated domain authentication, and it works as I am getting an access token,&lt;BR /&gt;which I then pass back to the front-end.&lt;/P&gt;&lt;P&gt;This has been working just fine, until yesterday when I started getting the below errors on the client (using Chrome).&lt;/P&gt;&lt;P&gt;Nothing changed on my end.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pbiCapture.PNG" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/122103iC0DBC57AE5DDFECE/image-size/large?v=v2&amp;amp;px=999" role="button" title="pbiCapture.PNG" alt="pbiCapture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Herewith is my embed code:&lt;BR /&gt;_accessToken is the object I got frm mny Rest API with the auth token.&lt;/P&gt;&lt;P&gt;var embedUrl = "&lt;A href="https://app.powerbi.com/reportEmbed?reportId=" target="_blank"&gt;https://app.powerbi.com/reportEmbed?reportId=&lt;/A&gt;" + _accessToken.reportid + "&amp;amp;groupId=" + _accessToken.groupid;&lt;BR /&gt;var models = window['powerbi-client'].models;&lt;BR /&gt;var config = {&lt;BR /&gt;type: 'report',&lt;BR /&gt;accessToken: _accessToken.token,&lt;BR /&gt;embedUrl: embedUrl&lt;BR /&gt;, settings: {&lt;BR /&gt;filterPaneEnabled: false,&lt;BR /&gt;navContentPaneEnabled: true,&lt;BR /&gt;background: models.BackgroundType.Transparent&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;// Grab the reference to the div HTML element that will host the report.&lt;BR /&gt;var reportContainer = document.getElementById('dashboard-content');&lt;/P&gt;&lt;P&gt;// Embed the report and display it within the div container.&lt;BR /&gt;var report = powerbi.embed(reportContainer, config);&lt;/P&gt;&lt;P&gt;And here is the C# to get the access token&lt;BR /&gt;Dictionary&amp;lt;string, object&amp;gt; tokendata = new Dictionary&amp;lt;string, object&amp;gt;();&lt;BR /&gt;try {&lt;BR /&gt;var credential = new UserPasswordCredential(PowerBIUsr,PowerBIPwd);&lt;/P&gt;&lt;P&gt;// Authenticate using created credentials&lt;BR /&gt;var authenticationContext = new AuthenticationContext("&lt;A href="https://login.windows.net/common/oauth2/authorize/" target="_blank"&gt;https://login.windows.net/common/oauth2/authorize/&lt;/A&gt;");&lt;BR /&gt;var authenticationResult = await Task.Run(() =&amp;gt; authenticationContext.AcquireTokenAsync("&lt;A href="https://analysis.windows.net/powerbi/api" target="_blank"&gt;https://analysis.windows.net/powerbi/api&lt;/A&gt;", PowerBIClientId.ToString(), credential));&lt;/P&gt;&lt;P&gt;if (authenticationResult == null) {&lt;BR /&gt;tokendata.Add("error", "{athfailed}");&lt;/P&gt;&lt;P&gt;} else {&lt;BR /&gt;tokendata.Add("reportid", this.Settings.PowerBIRepId);&lt;BR /&gt;tokendata.Add("groupid", this.Settings.PowerBIGrpId);&lt;BR /&gt;tokendata.Add("clientid", this.Settings.PowerBIClientId);&lt;BR /&gt;tokendata.Add("token", authenticationResult.AccessToken);&lt;BR /&gt;tokendata.Add("tokentype", authenticationResult.AccessTokenType);&lt;BR /&gt;tokendata.Add("tokenexpiry", authenticationResult.ExpiresOn);&lt;BR /&gt;}&lt;BR /&gt;} catch (Exception ex) {&lt;BR /&gt;tokendata.Add("error", "{athfailed}");&lt;BR /&gt;tokendata.Add("errorO", ex);&lt;BR /&gt;}&lt;BR /&gt;this.TokenData = tokendata;&lt;/P&gt;&lt;P&gt;Any help will be much appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;</description>
    <pubDate>Wed, 26 Sep 2018 11:06:37 GMT</pubDate>
    <dc:creator>DirkCoetzee</dc:creator>
    <dc:date>2018-09-26T11:06:37Z</dc:date>
    <item>
      <title>Power BI Embed error</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-error/m-p/526419#M16202</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am embedding a power BI report using the Javascript API.&lt;BR /&gt;The application is a jQuery and Javascript front-end and using a WCF Rest API.&lt;BR /&gt;I do the authentication in the Rest API, no integrated domain authentication, and it works as I am getting an access token,&lt;BR /&gt;which I then pass back to the front-end.&lt;/P&gt;&lt;P&gt;This has been working just fine, until yesterday when I started getting the below errors on the client (using Chrome).&lt;/P&gt;&lt;P&gt;Nothing changed on my end.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pbiCapture.PNG" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/122103iC0DBC57AE5DDFECE/image-size/large?v=v2&amp;amp;px=999" role="button" title="pbiCapture.PNG" alt="pbiCapture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Herewith is my embed code:&lt;BR /&gt;_accessToken is the object I got frm mny Rest API with the auth token.&lt;/P&gt;&lt;P&gt;var embedUrl = "&lt;A href="https://app.powerbi.com/reportEmbed?reportId=" target="_blank"&gt;https://app.powerbi.com/reportEmbed?reportId=&lt;/A&gt;" + _accessToken.reportid + "&amp;amp;groupId=" + _accessToken.groupid;&lt;BR /&gt;var models = window['powerbi-client'].models;&lt;BR /&gt;var config = {&lt;BR /&gt;type: 'report',&lt;BR /&gt;accessToken: _accessToken.token,&lt;BR /&gt;embedUrl: embedUrl&lt;BR /&gt;, settings: {&lt;BR /&gt;filterPaneEnabled: false,&lt;BR /&gt;navContentPaneEnabled: true,&lt;BR /&gt;background: models.BackgroundType.Transparent&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;// Grab the reference to the div HTML element that will host the report.&lt;BR /&gt;var reportContainer = document.getElementById('dashboard-content');&lt;/P&gt;&lt;P&gt;// Embed the report and display it within the div container.&lt;BR /&gt;var report = powerbi.embed(reportContainer, config);&lt;/P&gt;&lt;P&gt;And here is the C# to get the access token&lt;BR /&gt;Dictionary&amp;lt;string, object&amp;gt; tokendata = new Dictionary&amp;lt;string, object&amp;gt;();&lt;BR /&gt;try {&lt;BR /&gt;var credential = new UserPasswordCredential(PowerBIUsr,PowerBIPwd);&lt;/P&gt;&lt;P&gt;// Authenticate using created credentials&lt;BR /&gt;var authenticationContext = new AuthenticationContext("&lt;A href="https://login.windows.net/common/oauth2/authorize/" target="_blank"&gt;https://login.windows.net/common/oauth2/authorize/&lt;/A&gt;");&lt;BR /&gt;var authenticationResult = await Task.Run(() =&amp;gt; authenticationContext.AcquireTokenAsync("&lt;A href="https://analysis.windows.net/powerbi/api" target="_blank"&gt;https://analysis.windows.net/powerbi/api&lt;/A&gt;", PowerBIClientId.ToString(), credential));&lt;/P&gt;&lt;P&gt;if (authenticationResult == null) {&lt;BR /&gt;tokendata.Add("error", "{athfailed}");&lt;/P&gt;&lt;P&gt;} else {&lt;BR /&gt;tokendata.Add("reportid", this.Settings.PowerBIRepId);&lt;BR /&gt;tokendata.Add("groupid", this.Settings.PowerBIGrpId);&lt;BR /&gt;tokendata.Add("clientid", this.Settings.PowerBIClientId);&lt;BR /&gt;tokendata.Add("token", authenticationResult.AccessToken);&lt;BR /&gt;tokendata.Add("tokentype", authenticationResult.AccessTokenType);&lt;BR /&gt;tokendata.Add("tokenexpiry", authenticationResult.ExpiresOn);&lt;BR /&gt;}&lt;BR /&gt;} catch (Exception ex) {&lt;BR /&gt;tokendata.Add("error", "{athfailed}");&lt;BR /&gt;tokendata.Add("errorO", ex);&lt;BR /&gt;}&lt;BR /&gt;this.TokenData = tokendata;&lt;/P&gt;&lt;P&gt;Any help will be much appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 11:06:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-Embed-error/m-p/526419#M16202</guid>
      <dc:creator>DirkCoetzee</dc:creator>
      <dc:date>2018-09-26T11:06:37Z</dc:date>
    </item>
  </channel>
</rss>

