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

dees040's avatar

CRSF error and no session's

I just deployed my code from my local env to my production env with Forge. But now when I submit my login form I get an error: TokenMismatchException in VerifyCsrfToken.php.

When I turn of the CSRF protection. And fill in fake data I do get redirected back but the page doesn't give me any errors. Which should like on my local env. When I do Session::set('test', true) and Session::get('test') (on the same page) I do get a true.

I tried many solutions on many forums, nothing worked.

Does somebody know what I'm doing wrong?

Update I now think that my sessions don't work, no clue why.

0 likes
11 replies
hero21's avatar

Are you using the default auth system? If not, share your login form code.

tomopongrac's avatar

Maybe the problem is in session driver

try change to memcached

dees040's avatar

@hero21

I only added one trait for Socialite. So I'm not sure if the problem is in the AuthController.

dees040's avatar

@tomi

I tried memcached and Redis. Still the same results.

d3xt3r's avatar

Are cookies being set ? If not check your cookies configuration ?

dees040's avatar

@d3xt3r

Laravel hasn't set any cookies yet. Not sure where I can find the cookies config (file)?

d3xt3r's avatar

Check your config/session.php and tell us what you see ?

dees040's avatar

It is correct, just did that for the paste.

d3xt3r's avatar
d3xt3r
Best Answer
Level 29

Its not correct, and i am definitely not talking about THE_IP.

remove the http:// and the trailing /

Please or to participate in this conversation.