Forum Discussion
how to change embed-token duration
hi,
i want to change the 60min timeout limit on my power bi embed tokens.
this is how i get my token:
PBIReport pbiReport = new PBIReport();
var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: tokenAccessLevel, datasetId: pbiReport.DatasetId, allowSaveAs: allowSaveAs);
pbiReport.EmbedToken = typeof(PowerBIClient) client.Reports.GenerateTokenInGroup(groupId, reportId, generateTokenRequestParameters);
but i cant change the duration....where can i set it?
1 Reply
- AnonymousNot applicable
Hi Muesli,
I checked the corresponding rest API but not found any related option to allow you to increase the expiry time of the token. So I think you can't directly use this rest API to achieve your requirement.
For your scenarios, I think you can research in two directions.
First, power bi embed tokens are generated from the azure side. AFAIK, azure has a token lifetime configuration menu for its tokens, you can check them to confirm if they provide the options to modify the lifetime of embed tokens.
Configurable token lifetimes in Microsoft identity platform (Preview)
Second, you can consider using programming codes to achieve auto-replace expired tokens to indirectly increase the embed contents usage lifetimes. (e.g. stored respond token and expired time into the session or other variables, then you can add a looping timer to check if this token expired and re-invoke the generated token API to get the new token for the following usage)
Hope above helps for your requirement.
Regards,
Xiaoxin Sheng