Reputation: 37
Im trying to make it so a specific user is always logged in using the flask security extension.
I cant find any docs on this. Can someone point me in the right direction to start.
Upvotes: 1
Views: 446
Reputation: 603
https://flask-login.readthedocs.io/en/latest/#cookie-settings
“Remember Me” functionality can be tricky to implement. However, Flask-Login makes it nearly transparent - just pass remember=True to the login_user call. A cookie will be saved on the user’s computer, and then Flask-Login will automatically restore the user ID from that cookie if it is not in the session. The cookie is tamper-proof, so if the user tampers with it (i.e. inserts someone else’s user ID in place of their own), the cookie will merely be rejected, as if it was not there.
REMEMBER_COOKIE_DURATION
The amount of time before the cookie expires, as a datetime.timedelta object. Default: 365 days (1 non-leap Gregorian year)
Upvotes: 1