My CSRF token seems to be timing out. Is there any way to prevent this?
I have a single page app where my frontend is written in AngularJS. For the most part, my CSRF token’s validate fine and I can confirm that I send the token in through every request. However, occasionally I will see errors from my server saying that “The CSRF token could not be verified”. I do not fully understand the internals of how the CSRF token is verified, but is there any reason for why this would be happening?
Our application is also international, but because of our server infrastructure there is slowdown in certain geographical areas. I’ve noticed (just ad-hoc) that if, for example, the user is uploading a file and the request takes longer than usual, the chances of the CSRF token being invalid is higher.
Would love to hear any ideas about this! Thanks in advance!