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

respect_'s avatar

Can't figure out 419 error on simple form :/

NB: I'm using laravel, inertia + react.

Hello there folks,

I have a simple form that users would enter their email address in and then submit. I reused a form from my login page, made the changes, and then created a controller, and updated my routes file. But to my surprised, I keep encountering 419 error.

When I check the network tab, the csrf token can be found. I'm super unclear on what could be causing the mismatch. Again, I have other forms like login and sign up, and I've never had this issue before.

Does anyone have any ideas? Thank you.

0 likes
13 replies
jlrdw's avatar

Make sure your session folder has the correct permissions.

respect_'s avatar

@jlrdw this is what my sessions file look like:

Any thoughts?

respect_'s avatar

@jlrdw this is all local. All tables are already migrated. I wnet and cleared all the cache and such again.

Allow me to share some more code here if that's okay.

Waitlist Form

Waitlist Controller

web.php

Route::middleware(['web'])->group(function () {
    Route::get('/waitlist', [WaitlistController::class, 'index'])->name('waitlist.index');
    Route::post('/waitlist', [WaitlistController::class, 'store'])->name('waitlist.store');
});

Waitlist Model

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Waitlist extends Model
{
    use HasFactory;
    protected $fillable = ['email'];
}

I hope this helps to add some more context.

jlrdw's avatar

@respect_ check Inertia docs, you probably need a X-XSRF-TOKEN setup.

But i'm not that familiar with inertia.

respect_'s avatar

Sure, but it does seem that the token is being added by default?

https://imgur.com/a/1Rcab8H

I also tried to add the token manually, but had the same issue.

It's such a pain.

jlrdw's avatar

@respect_ see if it's in the session database. The one you see has to match the one in session.

Edit:

Try writing something to session on a page, go to another page and make sure you can retrieve it.

Like:

$request->session()->put('myvalue', 'hello');

then

echo $request->session()->get('myvalue');
respect_'s avatar

@jlrdw nothing is in the sessions table currently. The waitlist page is front facing, so no auth should be required.

respect_'s avatar

@jlrdw I tried to write to the sessions, nothing. I'll just hang up the towel for now. Thanks for trying to help.

jlrdw's avatar

@respect_ something must be setup wrong. I suggest watching some of the videos from this very site and you might catch what is wrong.

Many of the videos are free.

Or at least review each pertinent section in the documentation. Probably one little thing needs tweaked.

respect_'s avatar

Thinking the very same, I may just go over it this weekend and write everything from scratch and see. Will post and update once I figure it out.

neil7209's avatar

Just checking if you found a solution. Blade forms work but not react. I'm getting this same error despite many starting from scratch even on linux and windows. Tried all suggestions mentioned above. Just want to know before starting work on a workaround and wait and see on the next version if it works.

Please or to participate in this conversation.