<?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: Integrate tile into an app sample javascript error. in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/136487#M4695</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;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try that IP address I get insecure response:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="InsecureResponse.PNG" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/31602i090ADC246544A3ED/image-size/large?v=v2&amp;amp;px=999" role="button" title="InsecureResponse.PNG" alt="InsecureResponse.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also get all 200s but the tile never appears (only the spinning dots) and the JS error every time. The remote server I am hitting is &amp;nbsp;137.116.81.69:443.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="200s.PNG" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/31605i28B5EF37CF046293/image-size/large?v=v2&amp;amp;px=999" role="button" title="200s.PNG" alt="200s.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Mar 2017 18:05:11 GMT</pubDate>
    <dc:creator>ajhops</dc:creator>
    <dc:date>2017-03-03T18:05:11Z</dc:date>
    <item>
      <title>Integrate tile into an app sample javascript error.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/134539#M4637</link>
      <description>&lt;P&gt;Following the steps in the sample here:&amp;nbsp;&lt;A href="https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-integrate-tile/" target="_blank"&gt;https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-integrate-tile/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the final step, load the tile into an iFrame I have a problem posting the messageStructure to the iframe source.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var messageStructure = {
        action: "loadTile",
        accessToken: document.getElementById('MainContent_accessToken').value,
        height: 500,
        width: 500
    };
    message = JSON.stringify(messageStructure);

    // Push the message
    document.getElementById('iFrameEmbedTile').contentWindow.postMessage(message, "*");;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A Javascript error occurs in powerbivisualrenderer.min.js when the atob method is called on a string that is not base64 encoded. My hunch is that the access token is supposed to be a valid base64 string. I verified that by passing in a valid base64 string in the accessToken variable, and the error ceased (but of course I got a 403 forbidden).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My access token is 1475 characters long with no "=" sign at the end and is definitely not a base64 encoded string. The access token is working everywhere else in that example in the server side code when sent in the authorization header.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, is the accessToken supposed to be a Base64 encoded string? If not, what would cause this error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;caught DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.&lt;BR /&gt;at T (&lt;A href="https://app.powerbi.com/13.0.1700.1256/scripts/powerbivisualrenderer.min.js:2:16257" target="_blank"&gt;https://app.powerbi.com/13.0.1700.1256/scripts/powerbivisualrenderer.min.js:2:16257&lt;/A&gt;)&lt;BR /&gt;at Object.success (&lt;A href="https://app.powerbi.com/13.0.1700.1256/scripts/powerbivisualrenderer.min.js:2:10067" target="_blank"&gt;https://app.powerbi.com/13.0.1700.1256/scripts/powerbivisualrenderer.min.js:2:10067&lt;/A&gt;)&lt;BR /&gt;at j (&lt;A href="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.min.js:2:26860" target="_blank"&gt;https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.min.js:2:26860&lt;/A&gt;)&lt;BR /&gt;at Object.fireWith [as resolveWith] (&lt;A href="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.min.js:2:27673" target="_blank"&gt;https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.min.js:2:27673&lt;/A&gt;)&lt;BR /&gt;at x (&lt;A href="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.min.js:4:11120" target="_blank"&gt;https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.min.js:4:11120&lt;/A&gt;)&lt;BR /&gt;at XMLHttpRequest.&amp;lt;anonymous&amp;gt; (&lt;A href="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.min.js:4:14767" target="_blank"&gt;https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.min.js:4:14767&lt;/A&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 19:41:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/134539#M4637</guid>
      <dc:creator>ajhops</dc:creator>
      <dc:date>2017-02-28T19:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: Integrate tile into an app sample javascript error.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/135455#M4666</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/22568"&gt;@ajhops&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I don't experience that error. My token is a long string starts with "eyJ0eX....". Here is a static HTML which works perfect in my test, just replace the embed url and token with the ones in your case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt; 
    &amp;lt;script type="text/javascript"&amp;gt;

        window.onload = function () {
		
		updateEmbedTile(); 
        };

        var width = 500;
        var height = 500; 

        // update embed tile
        function updateEmbedTile() {
            // replace your embed url here
            var embedTileUrl = "https://app.powerbi.com/embed?dashboardId=f1f5155b-c6e2-4147-991b-28d914927d05&amp;amp;tileId=2dcd2a32-725e-4454-9753-b3e01e41a4a1";
            if ("" === embedTileUrl)
                return;

            // to load a tile do the following:
            // 1: set the url, include size.
            // 2: add a onload handler to submit the auth token
            iframe = document.getElementById('iFrameEmbedTile');
            iframe.src=embedTileUrl + "&amp;amp;width=" + width + "&amp;amp;height=" + height;
            iframe.onload = postActionLoadTile;
        }

        
        // post the auth token to the iFrame. 
        function postActionLoadTile() {
            // replace your token here
            accessToken = "eyJ0eXAiOiJKV....kGoJT_tGqBbsXCv60YIXJZTdheFAiwFw";

            // return if no a
            if ("" === accessToken)
                return;

            var h = height;
            var w = width; 

            // construct the push message structure
            var m = { action: "loadTile", accessToken: accessToken, height: h, width: w};
            message = JSON.stringify(m);

            // push the message.
            iframe = document.getElementById('iFrameEmbedTile');
            iframe.contentWindow.postMessage(message, "*");;
        }

    &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;

&amp;lt;iframe ID="iFrameEmbedTile" src="" height="500px" width="500px" frameborder="0" seamless&amp;gt;&amp;lt;/iframe&amp;gt;

 
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 06:59:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/135455#M4666</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-03-02T06:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Integrate tile into an app sample javascript error.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/135769#M4676</link>
      <description>&lt;P&gt;Thank you for your reply! I still get the same error. My access token also starts with "eyJ0eXAiOiJ" and is very long. There are no new lines in the string and no whitespace. Can you do me one quick favor and open your browser developer console and execute:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;atob("YOUR_ACCESS_TOKEN")&lt;/PRE&gt;&lt;P&gt;and tell me if you get an error.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 16:19:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/135769#M4676</guid>
      <dc:creator>ajhops</dc:creator>
      <dc:date>2017-03-02T16:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: Integrate tile into an app sample javascript error.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/136063#M4682</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/22568"&gt;@ajhops&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've got the same error,&amp;nbsp;however I can still embed with that token.&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="Capture.PNG" style="width: 553px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/31512i2F4A7DCC5C24D19F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Embedding is working fine with the HTML in my previous reply. All responses 200(ok).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture2.PNG" style="width: 490px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/31513i4310C5D2BF74E9CD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture2.PNG" alt="Capture2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure if it is the issue of the cluster node, will you try to replace the app.powerbi.com in the embed url with below IP, it is the actual remote server in my test, captured from the chrome dev tool.&lt;/P&gt;
&lt;PRE&gt;https://&lt;STRONG&gt;13.78.91.196&lt;/STRONG&gt;/embed?dashboardId=f1f5155bxxxxx914927d05&amp;amp;tileId=2dcd2a32-725e-4454-9753-b3&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 01:44:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/136063#M4682</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-03-03T01:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Integrate tile into an app sample javascript error.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/136487#M4695</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;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I try that IP address I get insecure response:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="InsecureResponse.PNG" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/31602i090ADC246544A3ED/image-size/large?v=v2&amp;amp;px=999" role="button" title="InsecureResponse.PNG" alt="InsecureResponse.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also get all 200s but the tile never appears (only the spinning dots) and the JS error every time. The remote server I am hitting is &amp;nbsp;137.116.81.69:443.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="200s.PNG" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/31605i28B5EF37CF046293/image-size/large?v=v2&amp;amp;px=999" role="button" title="200s.PNG" alt="200s.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 18:05:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/136487#M4695</guid>
      <dc:creator>ajhops</dc:creator>
      <dc:date>2017-03-03T18:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Integrate tile into an app sample javascript error.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/137090#M4713</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/22568"&gt;@ajhops&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Have you tested with my HTML? What's going on when in IE, do you still get the atob error? May I know how you generate the accessToken?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 07:25:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/137090#M4713</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-03-06T07:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Integrate tile into an app sample javascript error.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/137495#M4730</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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run in IE I get "InvalidCharacterError". I believe this is the same error as before.&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="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/31852i9BAD95DF5E760F84/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To answer your question, yes I am using your static HTML but replace with my token and tile URL. I generate my access token on my back end (.net MVC) using this line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var ar = AC.AcquireTokenByAuthorizationCodeAsync(
                authorizationCode,
                new Uri(redirectUri), cc).Result;

   
return ar.AccessToken;&lt;/PRE&gt;&lt;P&gt;I later use that access token server side to get my list of dashboards and tiles, and the result is good, so I assume my token is good / correct (the variable _token below).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;System.Net.WebRequest request = System.Net.WebRequest.Create(
                String.Format("{0}Dashboards", _baseUri
                )) as System.Net.HttpWebRequest;

request.Method = "GET";
request.ContentLength = 0;
request.Headers.Add("Authorization", String.Format("Bearer {0}", &lt;FONT color="#339966"&gt;_token&lt;/FONT&gt;));&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Mar 2017 20:10:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/137495#M4730</guid>
      <dc:creator>ajhops</dc:creator>
      <dc:date>2017-03-06T20:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Integrate tile into an app sample javascript error.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/139193#M4810</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/22568"&gt;@ajhops&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Well, then I suggest you open a &lt;A href="https://powerbi.microsoft.com/en-us/support/pro/" target="_self"&gt;support ticket&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2017 01:27:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Integrate-tile-into-an-app-sample-javascript-error/m-p/139193#M4810</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-03-09T01:27:38Z</dc:date>
    </item>
  </channel>
</rss>

