Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Muesli
Advocate I
Advocate I

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 1
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.