Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello all,
I write for some clarifications. Following the instructions in the last two videos of the documentation section of this page, I have embedded a report into an html code that I have run and that places a report into a web page. So far so good.
Problem is, I have obtained the token by running the code from the app owns data on this github in debug mode. I realize now (it probably was obvious to more savvy developer, but not to me) that that was likely just a trick. In fact, I have noticed that the token after a while expires and I need to run the software again and obtain a new (different) token.
Am I correct in thinking that the authorization token is not static, i.e. it changes and I will not be able to simply copy paste it into my html code once and be done with it?
Assuming I have to obtain the token dynamically, could you give me a suggestion on where to start? I know little (read nothing) of GET, POST, PUT and so on. I'm trying to reverse engineering what I find scattered on forums and the like. For example I have been using this simple code to embed the report:
// Get models. models contains enums that can be used. var models = window['powerbi-client'].models; var embedConfiguration = { type: 'report', id: '5dac7a4a-4452-46b3-99f6-a25915e0fe55', embedUrl: 'https://app.powerbi.com/reportEmbed', tokenType: models.TokenType.Aad, accessToken: 'e4...rf' }; var $reportContainer = $('#reportContainer'); var report = powerbi.embed($reportContainer.get(0), embedConfiguration);
What can I use to get the accessToken? Should I expand this html code adding something before it? Should I use the code in the example "App owns data"? But in that case, where shall I put the code I have downloaded from Github?
Take a look at the following:
Refresh token using JavaScript SDK example
Basically you need to set a listener on token expiration, once expired, call the SetAccessToken function to update it.
Regards,
Michael
Michael,
thank you for your answer. Unfortunately we need to take a step back. As the document at the link says, I'd need to implement a function generateEmbedToken() that calls the application Back End. Problem is, I've never written a single line of code in javascript, C# or html, nor do I know how Front End or Back End work or communicate.
I've downloaded the code app owns data at this link, I can try to understand what it does and I would be content with simply changing what I need in order to glue together something that works and embeds a report in a web page that I can later on go and change to my liking, but that's a second step. But the first obstacle is already "how do I turn the code I have downloaded in to a web page?"
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
6 | |
1 | |
1 | |
1 | |
1 |