Forum Discussion
Anybody know how to change and detect Power BI Embedded token expiration.
Hi Phineas,
Check to see if the response from RBreuer would help in your scenario:
"
When listening to errors, as in: https://github.com/Microsoft/PowerBI-JavaScript/wiki/Handling-Events#full-list-of-events-and-their-response-values you can subscribe to report.on('error', ...) and access the message propery in the error object to detect token expiration.
Once detected, you can use the JS SDK to apply a new token without having to reload the embedded report https://github.com/Microsoft/PowerBI-JavaScript/wiki/Update-Embed-Token
of course, by using 'exp' in your JWT token, you can always set a timer to refresh the token
"
Regards,
Michael
Hi, Michael, Thanks for your reply.
I'll already seen the link you mentionded.
I tested it in my code by adding: "report.on('error',function(){...})", but the function will not be invoked. Instead, a 403 HTTP code will be returned with content "Access token has expired, resubmit with a new access token".
I know the expired time will be returned with embedded token by calling WEB API "GenerateTokenInGroupAsync(...)".
I want to know whether it is possible to change the expiration time. and is it possible to detect this in front-end.
Regards Phineas