Quantcast
Channel: Developer topics
Viewing all articles
Browse latest Browse all 17897

Generate token automatically when its getting expired

$
0
0

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.

 

I already posted here, but couldn't find a correct answer. power bi embedded access token . And I tried another source to solve Refresh token using JavaScript , but here I face a problem that how to implement the method generateEmbedToken(). 

 

The solution should be really helpful for my project and delay. Thanks in advance

 

 

The following code is working until the token generated form POSTMAN expires. 

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 => {
        report.getFilters()
            .then(filters => {
                filters.push(filter);
                return report.setFilters(filters);
            });});

report.fullscreen();
}

 


Viewing all articles
Browse latest Browse all 17897

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>