Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
EraseEgo
Frequent Visitor

Embedding with App owns data using client side Javascript alone

Is it possible to embed Power BI reports in the App owns data scenario with just client side Javascript? That is, with no backend application using Node JS or some other server side technology. 

 

The example that MS provides has the User owns data scenario in React (client only with no server side code). 

 

Is that a limitation imposed by the inability to pass the Azure AD app client secret in a client only Javascript scenario?

4 REPLIES 4
Akash_123
New Member

https://learn.microsoft.com/en-us/power-bi/developer/embedded/embed-sample-for-customers?tabs=node-j...

i am refering this link , i need show analytic report for each customer i have data of each customer i need to feed it dynamically to powerbi and generate report and i need show in my website also it can be done in ether nodejs or reactjs 

jamesqubit
New Member

Basically you need a backend server to generate a token as-per the app-owns-data flow if your clients will not have their own PowerBI accounts, as the tokens expire so cannot simply be embedded, and embedding the client secret would be insecure in client-side Javascript.  There are a range of samples here:
https://github.com/microsoft/PowerBI-Developer-Samples

Your backend will authenticate with Azure (a few choices available, such as service principal, but this is where a private secret comes into play) and that user will need a couple of permissions in AAD to reach PowerBI, and it will need permissions on the relevant report/data/etc (usually this means putting them in one workspace and grant the permission on there).

There is a good demo of the required values with embedding here https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html, which is handy for grabbing details to test with or to test tokens you have generated.

 A small azure function could handle returning a token for your application without building a whole website for this, such as this: https://www.c-sharpcorner.com/article/create-an-azure-function-app-to-generate-token-power-bi-embedd....

Ultimately if you chose to embed the private secrets then the node samples should be adaptable to client-side only, but I would recommend fetching the certificate or secrets and storing on-device in a secure location rather than including in the JS source.

v-lionel-msft
Community Support
Community Support

Hi @EraseEgo ,

 

Yes, you do not need to configure the server side of your website or application.

Please refer to this.

Embed a Power BI report in React JS to get report instance 

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi Lionel,

 

Thank you for your reply. However, in that example, they start with a token. My question is how do you get the token in a Javascript only app. I believe that maybe the reason App Owns Data is not possible in a Javascript only scenario. There is not a way to use the Client Secret in a Single Page App without a Backend server. 

 

Please let me know if it is possible to do App Owns Data (not User owns Data where user has to provide the credentials while accessing the report) without Server side code completely in Javascript.

 

Thanks

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.