<?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: Generate token automatically when its getting expired in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Generate-token-automatically-when-its-getting-expired/m-p/393688#M11713</link>
    <description>&lt;P&gt;Have you checked the following example?&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;The basic step should be:&lt;/P&gt;&lt;P&gt;1. Set a listener for token expire,&lt;/P&gt;&lt;P&gt;2. Use the generateEmbedToken () function to update the embed token.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Access token is a little different, see if the following article would help:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/walkthrough-push-data-get-token" target="_self"&gt;Get an authentication access token&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
    <pubDate>Wed, 11 Apr 2018 02:53:14 GMT</pubDate>
    <dc:creator>v-micsh-msft</dc:creator>
    <dc:date>2018-04-11T02:53:14Z</dc:date>
    <item>
      <title>Generate token automatically when its getting expired</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Generate-token-automatically-when-its-getting-expired/m-p/390053#M11586</link>
      <description>&lt;P&gt;I'm using embed url for the dashboard. So I'm creating fresh token from postman, and applying the generated token in javascript. This working fine until the token expires. My problem is, I need to always regenerate the token when it expires.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already posted here, but couldn't find a correct answer.&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Developer/power-bi-embedded-access-token/m-p/383157#M11370" target="_blank"&gt;power bi embedded access token&lt;/A&gt;&amp;nbsp;. And I tried another source to solve&amp;nbsp;&lt;A href="https://github.com/Microsoft/PowerBI-JavaScript/wiki/Refresh-token-using-JavaScript-SDK-example" target="_blank"&gt;Refresh token using JavaScript&lt;/A&gt;&amp;nbsp;, but here I face a problem that how to implement the method &lt;STRONG&gt;generateEmbedToken().&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The solution should be really helpful for my project and delay. Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The following code is working until the token generated form POSTMAN expires.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;window.onload = function () {

var embedUrl=//embedUrl
var id = //id
var accessToken= // accessToken

var embedConfiguration = {
	type: 'report',
	accessToken: accessToken,
	id: id,
	embedUrl: embedUrl,
	settings: {
	    filterPaneEnabled: false,
		navContentPaneEnabled: true
			}
};


var $reportContainer = $('#reportContainer');

var report = powerbi.embed($reportContainer.get(0), embedConfiguration);

report.on('loaded', event =&amp;gt; {
        report.getFilters()
            .then(filters =&amp;gt; {
                filters.push(filter);
                return report.setFilters(filters);
            });});

report.fullscreen();
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 04:54:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Generate-token-automatically-when-its-getting-expired/m-p/390053#M11586</guid>
      <dc:creator>varman</dc:creator>
      <dc:date>2018-04-05T04:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Generate token automatically when its getting expired</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Generate-token-automatically-when-its-getting-expired/m-p/393688#M11713</link>
      <description>&lt;P&gt;Have you checked the following example?&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;The basic step should be:&lt;/P&gt;&lt;P&gt;1. Set a listener for token expire,&lt;/P&gt;&lt;P&gt;2. Use the generateEmbedToken () function to update the embed token.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Access token is a little different, see if the following article would help:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/walkthrough-push-data-get-token" target="_self"&gt;Get an authentication access token&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 02:53:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Generate-token-automatically-when-its-getting-expired/m-p/393688#M11713</guid>
      <dc:creator>v-micsh-msft</dc:creator>
      <dc:date>2018-04-11T02:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Generate token automatically when its getting expired</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Generate-token-automatically-when-its-getting-expired/m-p/393707#M11714</link>
      <description>&lt;P&gt;Thank you so much for your contribution. This code is in .net. But I'm using java and javascript. Can't I implement this in javascript? Is there any tutorial for that? I feel better to do it in javascript.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 03:28:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Generate-token-automatically-when-its-getting-expired/m-p/393707#M11714</guid>
      <dc:creator>varman</dc:creator>
      <dc:date>2018-04-11T03:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Generate token automatically when its getting expired</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Generate-token-automatically-when-its-getting-expired/m-p/607878#M18330</link>
      <description>What is that first function in the example? Is it triggered by the SDK? Should be executed on load?</description>
      <pubDate>Thu, 24 Jan 2019 05:40:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Generate-token-automatically-when-its-getting-expired/m-p/607878#M18330</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-01-24T05:40:53Z</dc:date>
    </item>
  </channel>
</rss>

