Quantcast
Channel: Developer topics
Viewing all articles
Browse latest Browse all 18056

Integrate tile into an app sample javascript error.

$
0
0

Following the steps in the sample here: https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-integrate-tile/

 

In the final step, load the tile into an iFrame I have a problem posting the messageStructure to the iframe source. 

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, "*");;

 

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). 

 

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. 

 

So, is the accessToken supposed to be a Base64 encoded string? If not, what would cause this error:

 

caught DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
at T (https://app.powerbi.com/13.0.1700.1256/scripts/powerbivisualrenderer.min.js:2:16257)
at Object.success (https://app.powerbi.com/13.0.1700.1256/scripts/powerbivisualrenderer.min.js:2:10067)
at j (https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.min.js:2:26860)
at Object.fireWith [as resolveWith] (https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.min.js:2:27673)
at x (https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.min.js:4:11120)
at XMLHttpRequest.<anonymous> (https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.1.min.js:4:14767)


Viewing all articles
Browse latest Browse all 18056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>