<?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: power bi embedded access token in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/power-bi-embedded-access-token/m-p/383157#M11370</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think there is a way to generate non expire token.&lt;/P&gt;&lt;P&gt;Instead, the token could be updated through the SetAccessToken function:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Microsoft/PowerBI-JavaScript/wiki/Update-Embed-Token" target="_self"&gt;SetAccessToken&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For a workthrough about how to get an Access token, please follow:&lt;/P&gt;&lt;P&gt;1. &lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/get-azuread-access-token" target="_self"&gt;R&lt;SPAN&gt;etrieve an access token&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;2. &lt;A href="https://community.powerbi.com/t5/Developer/How-To-Get-embed-token-using-Get-Post-only/td-p/294475" target="_self"&gt;How To: Get embed token using Get/Post only&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>Sun, 25 Mar 2018 01:07:00 GMT</pubDate>
    <dc:creator>v-micsh-msft</dc:creator>
    <dc:date>2018-03-25T01:07:00Z</dc:date>
    <item>
      <title>power bi embedded access token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/power-bi-embedded-access-token/m-p/378639#M11328</link>
      <description>&lt;P&gt;Hi, Im very new to power bi. I just want to generate tokens. I refered few online articals to find code in javascript.&amp;nbsp; this returns errors. How can I get non expire access token? If it is expired aslo, i need to get new token&lt;/P&gt;&lt;PRE&gt;window.onload = function () {

var embedUrl=//embedUrl
var id = //id

var embedConfiguration = {
	type: 'report',
	accessToken: getAccessToken,
	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();
}
    
var getAccessToken = function () {

	return new Promise(function(resolve, reject) {

		var url = 'https://login.microsoftonline.com/common/oauth2/token';

		var username = //username
		var password = //password
		var clientId = //clientId

		var headers = {
		  'Content-Type' : 'application/x-www-form-urlencoded'
		};

		var formData = {
			grant_type:'password',
			client_id: clientId,
			resource:'https://analysis.windows.net/powerbi/api',
			scope:'openid',
			username: username,
			password: password
		};

		request.post({
			url:url,
			form:formData,
			headers:headers

		}, function(err, result, body) {
			if(err) return reject(err);
			var bodyObj = JSON.parse(body);
			resolve(bodyObj.access_token);
		})
	  });
	}&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Mar 2018 07:34:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/power-bi-embedded-access-token/m-p/378639#M11328</guid>
      <dc:creator>varman</dc:creator>
      <dc:date>2018-03-19T07:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: power bi embedded access token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/power-bi-embedded-access-token/m-p/383157#M11370</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think there is a way to generate non expire token.&lt;/P&gt;&lt;P&gt;Instead, the token could be updated through the SetAccessToken function:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Microsoft/PowerBI-JavaScript/wiki/Update-Embed-Token" target="_self"&gt;SetAccessToken&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For a workthrough about how to get an Access token, please follow:&lt;/P&gt;&lt;P&gt;1. &lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/get-azuread-access-token" target="_self"&gt;R&lt;SPAN&gt;etrieve an access token&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;2. &lt;A href="https://community.powerbi.com/t5/Developer/How-To-Get-embed-token-using-Get-Post-only/td-p/294475" target="_self"&gt;How To: Get embed token using Get/Post only&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>Sun, 25 Mar 2018 01:07:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/power-bi-embedded-access-token/m-p/383157#M11370</guid>
      <dc:creator>v-micsh-msft</dc:creator>
      <dc:date>2018-03-25T01:07:00Z</dc:date>
    </item>
  </channel>
</rss>

