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
Phineas
New Member

Anybody know how to change and detect Power BI Embedded token expiration.

I'm using Power BI Embedded with new Power BI Service (Not Power BI Workspace Collections). And I'm just using the "App owns data" approach for user to embed reports in web browser. We know embedded token has an expiration time.  See: https://msdn.microsoft.com/en-us/library/mt784614.aspx 

So my question is: Is there a way to set expiration time ?(Power BI Workspace Collections API has this parameter). If not, I'm a single page application, how can I detect the embedded token has expired ?

 

Sincerely.

Looking forward to your reply.

 

4 REPLIES 4
EttoreP
New Member

Hi, any news?

I'm also interested in how to set the expiration time of an embedded token with the "new powerBI", if it's possible.

 

Regards

I am also interested in setting the lifetime or expiration time of the embed token for testing. Is this possible with teh new API?

v-micsh-msft
Employee
Employee

Hi @Phineas,

 

 

Check to see if the response from RBreuer would help in your scenario:

"

When listening to errors, as in: https://github.com/Microsoft/PowerBI-JavaScript/wiki/Handling-Events#full-list-of-events-and-their-r... you can subscribe to report.on('error', ...) and access the message propery in the error object to detect token expiration.

Once detected, you can use the JS SDK to apply a new token without having to reload the embedded report https://github.com/Microsoft/PowerBI-JavaScript/wiki/Update-Embed-Token

of course, by using 'exp' in your JWT token, you can always set a timer to refresh the token

"

Regards,

Michael

Hi, Michael, Thanks for your reply.

 

I'll already seen the link you mentionded.

I tested it in my code by adding: "report.on('error',function(){...})", but the function will not be invoked. Instead, a 403 HTTP code will be returned with content "Access token has expired, resubmit with a new access token".

I know the expired time will be returned with embedded token by calling WEB API "GenerateTokenInGroupAsync(...)".

 

I want to know whether it is possible to change the expiration time. and is it possible to detect this in front-end.

 

Regards Phineas

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.