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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.