# Ability to renew session for 2fa

**URL:** <https://forum.pritunl.com/t/ability-to-renew-session-for-2fa/2149>\
**Category:** Pritunl VPN\
**Created:** [July 2, 2024, 10:02pm UTC](https://forum.pritunl.com/t/ability-to-renew-session-for-2fa/2149 "2024-07-02T22:02:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![timansky](https://forum.pritunl.com/user_avatar/forum.pritunl.com/timansky/32/843_2.png) [@timansky](https://forum.pritunl.com/u/timansky)\
**Post date:** [July 2, 2024, 10:02pm UTC](https://forum.pritunl.com/t/ability-to-renew-session-for-2fa/2149/1 "2024-07-02T22:02:19Z")

</div>

Hi  
Need. help with plugin. Is there a way to renew session, or resend 2fa request with ttl without reconnect.  
We have custom 2fa realization within plugin. And i’m trying to make renew 2fa session (some kind of session cache) each min. If session expired or user blocked in external system then disconnect user.

app.session\_timeout not working

Server settings User Session Timeout makes reconnect (disconnect)

---

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [July 3, 2024, 1:57pm UTC](https://forum.pritunl.com/t/ability-to-renew-session-for-2fa/2149/2 "2024-07-03T13:57:04Z")

</div>

The [**two-step authentication cache**](https://docs.pritunl.com/docs/two-step-authentication-cache) documentation has more information. But the default is currently 7 days once the Pritunl Authentication Cache is enabled in the top right settings. For plugins the `user_connect` handler will include the kwarg `has_token` with a boolean value to indicate if the user connected with a valid cache token.

---

<div class="post-metadata">

**Author:** ![timansky](https://forum.pritunl.com/user_avatar/forum.pritunl.com/timansky/32/843_2.png) [@timansky](https://forum.pritunl.com/u/timansky)\
**Post date:** [July 3, 2024, 3:41pm UTC](https://forum.pritunl.com/t/ability-to-renew-session-for-2fa/2149/3 "2024-07-03T15:41:31Z")

</div>

[**two-step authentication cache**](https://docs.pritunl.com/docs/two-step-authentication-cache) as i understand is for integrated 2fa. Integrated is not an option for us. So we wrote own 2fa service.  
Main problem: **user\_connect** is called only when a user attempts to connect. But we want to check if user a valid each 5 mins from 2fa. If not disconnect him. Also at this time we renew 2fa session ttl if user is still connected.  
It can be achieved with **User Session Timeout** , but this cause full reconnection procedure.  
It would be ideal if we could periodically check authentication without reconnection.
