Resetting the expiration time for a cookie in Flask
Should be enough with:
from datetime import timedelta
# User will be logout after this time of inactivity
PERMANENT_SESSION_LIFETIME = timedelta(minutes=30)
SESSION_REFRESH_EACH_REQUEST = True
https://flask.palletsprojects.com/en/1.1.x/config/
You can renew the session to the client at each request using a @before_request
handler.
Try the following:
@app.before_request
def func():
session.modified = True