0

I have a view in my Laravel application that has a form with the @csrf inside. The problem is that I faced the 419 Page expired exception only sometimes.
When I refreshed the page, the login page appeared and after login, a few times the form submission was done successfully but again, 419 occurred.
I saw the other topics. All of them told that the solution is adding the @CSRF directive to the form.
But in my special case, the @CSRF exists.
Help me please.


Update

Here is a part of my source code. It's a simple html form with the @CSRF inside it.
<form method="POST" action="/settingUrl">
    @csrf
    <input type="text" name="myfield" />
    <input type="submit" value="save" />
</form>
Shahab.es
  • 367
  • 6
  • 20
  • Well, if you open the login page, leave it for sometime (lets say for example 30min) and come back, the csrf-token would have already expired, which explains why you are getting the error. – Marwane Ezzaze Dec 24 '22 at 12:33
  • Thanks, but I'm working with other pages. So, the session shouldn't be expired, I think. I'm routing around, going other pages, but only in my setting page, after some successful form submission, the page will be expired. – Shahab.es Dec 25 '22 at 03:09
  • Do you mind if you share samples of your code? – Marwane Ezzaze Dec 26 '22 at 16:04
  • The wired thing about this problem is that I just have a simple login form. It also consists the @CSRF directive. I updated the question with a small part of my form. – Shahab.es Dec 28 '22 at 12:31

0 Answers0