CSRF token expiration with flask and wtform

Viewed 646

What is the best practice when it comes to CSRF token expiration?

Say a user is visiting a page (Jinja template) with a form, but tries to submit says form only n hours later. The CSRF token is obviously expired by then.

Of course I could stretch the token's lifespan, but I'm looking for a better way to do this. Should I try and fetch a new token through an ajax request, before submitting the form with ajax?

0 Answers
Related