Yes. Power BI embedded access tokens have a limited lifetime, so the recommended approach is to refresh the token before it expires.
Two supported approaches are available:
- Manual refresh with
setAccessToken- Request a new token from the application backend before the current token expires.
- Update the embedded report without reloading it:
This works for both:await report.setAccessToken(newAccessToken);- Azure AD tokens used for embed for your organization
- Embed tokens used for embed for your customers
- Automatic refresh with
accessTokenProvider- This is supported only for embed for your organization when using an Azure AD token.
- Configure
accessTokenProviderinIEmbedConfigurationso the iframe requests a fresh token before expiry. - This requires powerbi-client 2.20.1 or later.
- The provider function must not throw; if token generation fails, it should return
null.
For the scenario described, if the application uses embed tokens, implement backend token renewal and call setAccessToken from the front end before expiry. If the application uses Azure AD tokens in the embed for your organization scenario, accessTokenProvider is the recommended automatic method.
If users are already seeing "Token Expired", that matches the documented embedded error where the access token has expired and a new access token must be submitted.
References: