Reputation: 21
I have been working on powerBI embedding for the last 6 months. I have the faced same issue of token expiration. I have generated refresh token, but that too (not sure) may be getting expired after some period of time.
Can any one please suggest me a better way to get token that doesn't expire or help me in re-usability of refresh token which I have stored.
Upvotes: 2
Views: 5532
Reputation: 577
There are two different tokens in Power BI: embed token and access token.
With embed token, if it's a web platform, you're able to refresh it automatically like this: https://github.com/Microsoft/PowerBI-JavaScript/wiki/Refresh-token-using-JavaScript-SDK-example
Or if you're using Power BI Embedded, you're able to create long lasting tokens: https://community.powerbi.com/t5/Developer/Integrate-PowerBI-with-Netsuite/m-p/93864#M3319
Access token is a bit different. It comes from Azure and depending on your platform, you might be able to refresh it automatically. If you're on web platform, the easiest way is to just hit F5, otherwise you'll need to automate this: https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-walkthrough-push-data-get-token/
Upvotes: 3