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

adito99's avatar

TokenMismatchException in VerifyCsrfToken.php (line 68) when I login/register in my online website

On my local server my projcet works fine.I upload it on shared hosting and set the database and my welcome view works fine but when i try to login or register i get this errorr TokenMismatchException in VerifyCsrfToken.php (line 68). All day Im searching for solution in the forums but nothing is working.

  • my sessions are stored in storage/framework/sessions and i have the tolkens saved there

if anyone can help

0 likes
11 replies
rumm.an's avatar

Is everything else working fine except those form submissions? Which shared hosting are you using?

jdunsmore's avatar

Can you also provide code snippets of your form and controllers for logging in / registering.

adito99's avatar

i just found that my sessions are empty on my web host on my localhost i get this ​``` {"_token":"svVMNyQ7qG5kB2PfD1EQMufFbn2c1MNMcvrOGmHQ","_flash":{"old":[],"new":[]},"_previous":{"url":"http://localhost:8000/en/welcome"}}

​``` and on my web host this

​``` array(1) { ["_token"]=> string(40) "n1xUZrmnhhMwTRPd7McWIbpvrv3uZZh9S2KSx84O" }

​``` i think the problem comes from here but i dont know how to solve it any ideas

jlrdw's avatar

This same exact question has come up numerous times here could you possibly try to do a search as it has been properly answered many times.

adito99's avatar

thank you very much sir you are the best

adito99's avatar

But I have tried most of the solution on the forums and still does't work , and as i said the only problem i find is in the session files

adito99's avatar
adito99
OP
Best Answer
Level 1

So I found the problem. It was in routes/web.php ! There was an extra line above <?php I deleted it and everything works :D

Please or to participate in this conversation.