Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MIS's avatar
Level 1

Token expired issue when submit form gets wired.

Encountering a wired issue! When requesting a page for the first time, the session token isn't stored, leading to a token expiration issue when submitting a form. However, from the second time onward, it gets stored.

While debugging the Laravel default ValidateCsrfToken middleware, it shows that initially, the session isn't stored, and it keeps generating a new token. However, after refreshing the page, the session gets stored. Do you have any idea why this is occurring?

This issue is also very frustrating for AJAX requests

0 likes
0 replies

Please or to participate in this conversation.