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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
daniel12
Advocate II
Advocate II

PowerBI Embedded: Embed Token Expiration?

Hi there,

 

simple question: PowerBI embedded embed tokens require to specify a time span for validity of the tokens. What is the best practice for the time span - eg. can I simply set the validity (exp: claim in JWT token) to large values like +8 hours to minimize issues with expiring tokens? How can an application embedding PowerBI embedded react to expired tokens? Currently when a token expires I seem to just get a "content is not available" from PowerBI. Any insights are highly welcome.

 

Cheers

Daniel

 

8 REPLIES 8
PowerBIUserHoop
Frequent Visitor

I am using the example from Github 'Embed for your customers' - .Net Core version.

 

Is it possible to renew the token and apply it to the report without having to reload the whole page, using JavaScript running in an ASP.Net Core website with an iFrame containg the report?

Please see this article regarding refreshing the token without page reload
Refresh the access token in Power BI embedded analytics | Microsoft Learn

Is it available for PBIX reports, not for paginated reports

Thanks for the reply.

 

I have looked at this article, but the getNewUserAccessToken(reportId, groupId) doesn't appear to be accessible.  An error message indicating that the funtion doesn't exist is displayed in the console.  

Is there a link which I should be including for a reference to that funtion?

 

jocaplan-MSFT
Microsoft Employee
Microsoft Employee

It is normally best to keep the token as short as needed. One hour is usually standard. This is just in case the tokens happen to leak out. There are good reasons why you may want to make them longer; 2 - 8+ hours. It really depends on the scenario and how much of a risk long lived tokens would be for you.

KumarDarmesh
Helper IV
Helper IV

There seems not way to change the expiration span, the demo shows it in 5 mintues.

https://azure.microsoft.com/en-us/documentation/articles/power-bi-embedded-what-is-power-bi-embedded...

Well you can set the expiration span as it's described here: https://azure.microsoft.com/en-us/documentation/articles/power-bi-embedded-app-token-flow/ (search for exp). But my question is more about best practices around how the embedding application can catch a situation where the report embed token has already expired and must be refreshed. Currently when you hit a dashboard where the token has already expired it just shows ugly errors.

Thanks

Daniel

 

ThomasDay
Impactful Individual
Impactful Individual

@daniel12  did you find out a way to prevent the ugly errors?  Here's what my embedded site looks like after a short time (sometimes 3 minutes--sometimes somewhat longer) if I select a new report tab.  Spectacularly awful, no?  Any ideas here?

Capture.PNG

In a server generated app you can get around this by generating a token for each render of the page.

 

In a single page app (SPA) - one option is to set a client-side timer on your page/view that is shorter than your token expiration.  At that point you can regenerate the token and reload the report passing in the new access token.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.