<?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: Obtaining token to embed report in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Obtaining-token-to-embed-report/m-p/412828#M12295</link>
    <description>&lt;P&gt;Michael,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've downloaded the code app owns data at &lt;A href="https://github.com/Microsoft/PowerBI-Developer-Samples" target="_self"&gt;this link&lt;/A&gt;, 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?"&lt;/P&gt;</description>
    <pubDate>Tue, 08 May 2018 13:16:01 GMT</pubDate>
    <dc:creator>Michele_Zanoni</dc:creator>
    <dc:date>2018-05-08T13:16:01Z</dc:date>
    <item>
      <title>Obtaining token to embed report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Obtaining-token-to-embed-report/m-p/412018#M12280</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I write for some clarifications.&amp;nbsp;Following the instructions in the last two videos of the documentation section of&amp;nbsp;&lt;A href="https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html#" target="_self"&gt;this page&lt;/A&gt;, 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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem is, I have obtained the token by running the code from the app owns data on&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://github.com/Microsoft/PowerBI-Developer-Samples" target="_self"&gt;this github&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="pl-c"&gt;// Get models. models contains enums that can be used.&lt;/SPAN&gt;
&lt;SPAN class="pl-k"&gt;var&lt;/SPAN&gt; models &lt;SPAN class="pl-k"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-c1"&gt;window&lt;/SPAN&gt;[&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;'&lt;/SPAN&gt;powerbi-client&lt;SPAN class="pl-pds"&gt;'&lt;/SPAN&gt;&lt;/SPAN&gt;].&lt;SPAN class="pl-smi"&gt;models&lt;/SPAN&gt;;

&lt;SPAN class="pl-k"&gt;var&lt;/SPAN&gt; embedConfiguration &lt;SPAN class="pl-k"&gt;=&lt;/SPAN&gt; {
	type&lt;SPAN class="pl-k"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;'&lt;/SPAN&gt;report&lt;SPAN class="pl-pds"&gt;'&lt;/SPAN&gt;&lt;/SPAN&gt;,
	id&lt;SPAN class="pl-k"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;'&lt;/SPAN&gt;5dac7a4a-4452-46b3-99f6-a25915e0fe55&lt;SPAN class="pl-pds"&gt;'&lt;/SPAN&gt;&lt;/SPAN&gt;,
	embedUrl&lt;SPAN class="pl-k"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;'&lt;/SPAN&gt;https://app.powerbi.com/reportEmbed&lt;SPAN class="pl-pds"&gt;'&lt;/SPAN&gt;&lt;/SPAN&gt;,
	tokenType&lt;SPAN class="pl-k"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pl-smi"&gt;models&lt;/SPAN&gt;.&lt;SPAN class="pl-smi"&gt;TokenType&lt;/SPAN&gt;.&lt;SPAN class="pl-smi"&gt;Aad&lt;/SPAN&gt;,
	accessToken&lt;SPAN class="pl-k"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;'&lt;/SPAN&gt;e4...rf&lt;SPAN class="pl-pds"&gt;'&lt;/SPAN&gt;&lt;/SPAN&gt;
};

&lt;SPAN class="pl-k"&gt;var&lt;/SPAN&gt; $reportContainer &lt;SPAN class="pl-k"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-en"&gt;$&lt;/SPAN&gt;(&lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;'&lt;/SPAN&gt;#reportContainer&lt;SPAN class="pl-pds"&gt;'&lt;/SPAN&gt;&lt;/SPAN&gt;);
&lt;SPAN class="pl-k"&gt;var&lt;/SPAN&gt; report &lt;SPAN class="pl-k"&gt;=&lt;/SPAN&gt; &lt;SPAN class="pl-smi"&gt;powerbi&lt;/SPAN&gt;.&lt;SPAN class="pl-en"&gt;embed&lt;/SPAN&gt;(&lt;SPAN class="pl-smi"&gt;$reportContainer&lt;/SPAN&gt;.&lt;SPAN class="pl-c1"&gt;get&lt;/SPAN&gt;(&lt;SPAN class="pl-c1"&gt;0&lt;/SPAN&gt;), embedConfiguration);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 15:30:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Obtaining-token-to-embed-report/m-p/412018#M12280</guid>
      <dc:creator>Michele_Zanoni</dc:creator>
      <dc:date>2018-05-07T15:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Obtaining token to embed report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Obtaining-token-to-embed-report/m-p/412738#M12293</link>
      <description>&lt;P&gt;Take a look at the following:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Microsoft/PowerBI-JavaScript/wiki/Refresh-token-using-JavaScript-SDK-example" target="_self"&gt;Refresh token using JavaScript SDK example&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically you need to set a&amp;nbsp;&lt;SPAN&gt;listener on token expiration, once expired, call the SetAccessToken function to update it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Michael&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 May 2018 10:39:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Obtaining-token-to-embed-report/m-p/412738#M12293</guid>
      <dc:creator>v-micsh-msft</dc:creator>
      <dc:date>2018-05-08T10:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Obtaining token to embed report</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Obtaining-token-to-embed-report/m-p/412828#M12295</link>
      <description>&lt;P&gt;Michael,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've downloaded the code app owns data at &lt;A href="https://github.com/Microsoft/PowerBI-Developer-Samples" target="_self"&gt;this link&lt;/A&gt;, 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?"&lt;/P&gt;</description>
      <pubDate>Tue, 08 May 2018 13:16:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Obtaining-token-to-embed-report/m-p/412828#M12295</guid>
      <dc:creator>Michele_Zanoni</dc:creator>
      <dc:date>2018-05-08T13:16:01Z</dc:date>
    </item>
  </channel>
</rss>

