I've got a form that has some fields that their values are loaded in by an ajax call to a controller after the first input is filled.
I have added the token as an input to my form with "@csrf" in my blade file.
To make the Ajax call I'm sending the CSRF token in the data section.
The first time I log in my application and load the page where the form is located I get the "CSRF Token Mismatch" error with status code 419 when doing the Ajax call. If I reload the page normally with F5 key or just clicking the reload button on my browser, it works flawlessly.
What is producing this behaviour in my application and how can I fix it?
I know we can bypass this issue by disabling the token protection for this route, but that's the last thing I want to do.