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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
sajjadniazi
New Member

Session Timeout in power Bi Embededd

Our application has a session timeout set to 30 minutes. We are using Power BI Embedded for integrating reports into our application. However, we are encountering an issue where the user session times out even while they are interacting with the embedded Power BI reports, leading to unexpected logouts.
 
We are seeking a solution that would allow us to keep the application session active while the user is engaged with the Power BI reports. Specifically, we are exploring the possibility of triggering events based on user interactions within the Power BI reports, which could be sent back to our application. These events would serve as "activity signals" that reset or extend the session timeout, ensuring the session remains active as long as the user is interacting with the report.
 
Is there a solution that utilizes Power BI's JavaScript API to listen for specific user actions? or is there a place where we can insert our custom JavaScript that would be globally executed whenever a report is rendered?
 
1 ACCEPTED SOLUTION
v-jianpeng-msft
Community Support
Community Support

Hi, @sajjadniazi 

You can refer to the following documentation to listen for events after this report is loaded in JavaScript

How to handle events in a Power BI embedded analytics application | Microsoft Learn

vjianpengmsft_0-1724213438890.png

When the session is about to expire, you can request a new token, you can refer to the JavaScript method in the following document to obtain it:

Refresh the access token in Power BI embedded analytics | Microsoft Learn

vjianpengmsft_1-1724213567083.png

In addition, if you want to listen to the user's actions on the report, you can use the following Javascript functions:

How to handle events in a Power BI embedded analytics application | Microsoft Learn

vjianpengmsft_2-1724213748004.png

Use these methods above to implement your needs. If you want to listen to these events globally, you need to use in JavaScript you can use: 

window.addEventListener('click', function(event) {
console.log('Global click event triggers');
});

Window addEventListener() Method (w3schools.com)

vjianpengmsft_3-1724214016179.png


This listens for global events, places the methods provided by the previous Power BI JavaScript into your global events, and sets the listening interval to ensure that the session doesn't time out back.

 

 

 

Best Regards

Jianpeng Li

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

View solution in original post

1 REPLY 1
v-jianpeng-msft
Community Support
Community Support

Hi, @sajjadniazi 

You can refer to the following documentation to listen for events after this report is loaded in JavaScript

How to handle events in a Power BI embedded analytics application | Microsoft Learn

vjianpengmsft_0-1724213438890.png

When the session is about to expire, you can request a new token, you can refer to the JavaScript method in the following document to obtain it:

Refresh the access token in Power BI embedded analytics | Microsoft Learn

vjianpengmsft_1-1724213567083.png

In addition, if you want to listen to the user's actions on the report, you can use the following Javascript functions:

How to handle events in a Power BI embedded analytics application | Microsoft Learn

vjianpengmsft_2-1724213748004.png

Use these methods above to implement your needs. If you want to listen to these events globally, you need to use in JavaScript you can use: 

window.addEventListener('click', function(event) {
console.log('Global click event triggers');
});

Window addEventListener() Method (w3schools.com)

vjianpengmsft_3-1724214016179.png


This listens for global events, places the methods provided by the previous Power BI JavaScript into your global events, and sets the listening interval to ensure that the session doesn't time out back.

 

 

 

Best Regards

Jianpeng Li

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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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