cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Silko Helper II
Helper II

report embed problem

I tried to embed reports the same way as tiles with the new api for reports list. Tiles are working perfectly but when I try to embed a report I get this error:
Uncaught SecurityError: Blocked a frame with origin "https://app.powerbi.com" from accessing a frame with origin "my domain hidden". Protocols, domains, and ports must match.

 

I followed this tutorial:
https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-integrate-a-power-bi-tile-or-rep...

 

Am I doing something wrong or is it a bug?

1 ACCEPTED SOLUTION

Accepted Solutions
Silko Helper II
Helper II

Re: report embed problem

Hi everyone,

 

it looks like Microsoft has taken care of this issue. I didn't change the code and it started working. It is still a little bit bugy for some types of visuals. But it renders now. The errors and warnings I get for some of the reports now:

 

errors.png

 

View solution in original post

17 REPLIES 17
pmathew2000
Frequent Visitor

Re: report embed problem

Try using the sample at https://github.com/Microsoft/PowerBI-CSharp ( folder embed-a-report-into-an-app under samples/webforms)

JasonDunbar Resolver I
Resolver I

Re: report embed problem

Hi @Silko,

 

@pmathew2000 - FYI too.

 

Having created API Embed samples already, I decided I'd integrate the ability to Embed a Report too. At first, I got to the same point as you, with the same cross origin javascript error.

 

[Edit] adding screenshot:

 PBIerror.png

 

So, I decided I'd create a new Azure Web App and publish the Microsoft sample to see what we're doing wrong. The steps I took:

  1. I cloned the Github repository - https://github.com/Microsoft/PowerBI-CSharp
  2. I made a new Azure Web App and set up the necessary Client ID, Client Secret and granted the relevant privileges to the App.
  3. I made the necessary changes to Response Uri in the Solution (https://github.com/Microsoft/PowerBI-CSharp/tree/master/samples/webforms/embed-a-report-into-an-app) and then hit publish from Visual Studio to publish to my Azure Web App.

Note: I did not modify any code in the solution that I cloned, other than to replace URIs and Settings

 

The result? Exactly the same.

 

It's not immediately obvious whether we're missing something or if it is indeed an issue. I'm raising this as an issue with Microsoft in the hope that we can find out and embed some reports soon 🙂

____________________________________________________
My other computer is an Azure data centre.
Silko Helper II
Helper II

Re: report embed problem

@JasonDunbar thank you for taking your time with this. I hope we will soon find out anything about this issue. It would be great to embed reports as soon as possible 🙂

pmathew2000
Frequent Visitor

Re: report embed problem

Thanks,

 

I was able to get the report  by running the solution from  Visual Studio 2013 from my local machine. So it seems some permission issues.

Microsoft wabreza
Microsoft

Re: report embed problem

Hey All,

 

I went through the sample app from https://github.com/Microsoft/PowerBI-CSharp and was able to successfully get a Power BI report to render.

 

One potential snag you may see will be making sure the Client ID you are using matches the url of  your application against the registered apps redirect url.

 

We have recently released a new app registration tool which should make this process super simple.  You can now register a new Power BI apps @ https://dev.powerbi.com/apps

StefanPersson
New Member

Re: report embed problem

Hi

 

Can you please share what step you did for me it hangs after embed reporter if you click F12

You get following error message

SCRIPT5: Access is denied.

File: reportEmbed, Line: 1, Column: 1

 

Best Regards

 

Stefan

 

Silko Helper II
Helper II

Re: report embed problem

@wabreza: The sample app on https://github.com/Microsoft/PowerBI-CSharp doesn't help me a lot because I'm working in PHP. I checked redirect url in my registered app and it's the same. If it wouldn't be also dashboard tiles wouldn't work, but they do.

@StefanPersson: I used this API function to get the report list, then I chose embed url from the report list and follow the steps in this tutorial to embed the report.

Microsoft wabreza
Microsoft

Re: report embed problem

@Silko - Can you share your code so I can help troubleshoot?

Silko Helper II
Helper II

Re: report embed problem

It is just a copy paste from a tutorial:

<iframe width="500px" height="500px" id="iFrameEmbedTile" onload="postActionLoadReport();" src="<?= $embedUrl; ?>&width=<?= $width; ?>&height=<?= $height; ?>"></iframe>
<script>
	function postActionLoadReport() {

        // get the access token.
        accessToken = "<?= $access_token; ?>";

        // return if accessToken is empty
        if ("" === accessToken)
            return;

        // construct the push message structure
        var m = { action: "loadReport", accessToken: accessToken };
        message = JSON.stringify(m);

        // push the message.
        iframe = document.getElementById('iFrameEmbedTile');
        iframe.contentWindow.postMessage(message, "*");;
    }
</script>

The part for gettng the list of reports is working ok. Just the part for embeding the report gives the error.

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors