If any token other than the last call to req.csrfToken() is passed it fails. In a situation where multiple clients are loading the page and each getting a token this means most form submissions will fail, because only the client last loading the page will have a valid csrf token.
To replicate:
- Run your example server.
- Verify you can submit correctly.
- Reload the page (so csrfToken is set again).
- Without submitting, open a new tab (so a new csrfToken is generated).
- Now go back to the first tab and submit.
- Observe the error as the csrf check things the first token generated is now invalid.
Maybe I'm missing something obvious but it seems to me this renders the library as not fit for purpose.
If any token other than the last call to
req.csrfToken()is passed it fails. In a situation where multiple clients are loading the page and each getting a token this means most form submissions will fail, because only the client last loading the page will have a valid csrf token.To replicate:
Maybe I'm missing something obvious but it seems to me this renders the library as not fit for purpose.