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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
sfdomingues
New Member

How to refresh token before it expires (using User Owns Data app sample from power bi embedded)

I have a sample app .sln that I downloaded from after registering an app in power bi embedded using User Owns Data Approach. The only thing I want to do with this is to show a report of mine in a smarttv and let the report be there forever without prompting for login ever again. So in my app's code I want to somehow refresh the access token periodically before it expires. I've seen the documentation: https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/refresh-token

I believe the section "Automatically refresh token example" is what I'm looking for but this isn't enough help for me, they provide an imcomplete "getNewAccessToken" that I have no idea how to complete or where to call it. I dont understand cs code or javascript, but with a bit of help I think I would be able to do this. Can I get any help from you?

1 REPLY 1
Anonymous
Not applicable

Hi @sfdomingues 

 

For security reasons, access tokens have a limited lifetime.

 

To maintain continuous access to Power BI reports without manual intervention, you need to implement a mechanism to automatically refresh the access token before it expires.


I found the following documentation for you that may be helpful.

 

What is the Power BI embedded analytics Client API | Microsoft Learn

 

reactjs - Refresh power bi client acces Token React - Stack Overflow

 

Regards,

Nono Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.