I'm using PowerBI-JavaScript library to embed the dashboard on my website :
var config = { type: 'dashboard', tokenType: models.TokenType.Embed, accessToken: accessToken, embedUrl: embedUrl, id: embedDashboardId }; // Get a reference to the embedded dashboard HTML element var dashboardContainer = $('#dashboardContainer')[0]; // Embed the dashboard and display it within the div container. var dashboard = powerbi.embed(dashboardContainer, config);
I wanna use setAccessToken to update my AccessToken keeping dashboard not expired, so I make function below :
function setToken() { dashboard.setAccessToken("newtoken") .then(function (r) { console.log(r); console.log("Update success!!") }) .catch(function (e) { console.error('Error setting access token', e); }); }
I can see "Update success!!" on console eventually. But when I use getAccessToken(), AccessToken is same as before. It didn't update my AccessToken!!
Please give me a advisement or solution to fix this problem! I would appreciate.