1

I am stuck with a very strange problem. I am not able to login using middleware. I guess just because the session token does not match the request token. How can I fixed this?

When I request to login. request token does not match the session token. However Session token changes every page refresh but requested token remains same. Finally I checked what exactly session and request token going ahead. as mentioned below

array:2 [▼
  "SessionToken" => "YDThBgfxnV6Lqv3STD2QF4l9IL2OQC7l2dN5LDJv"
  "RequetedToken" => "vhEp8swYB7sXNxg6GEzfgjrSDTAP7SuFo8Z57Psf"
]

Some Questions in my mind like.

why the same project is running perfectly fine on my another server and localhost? if there any server session issue? Why my session key and requested token is different? I am not using any kind of angular vue in this project. Please help me if anyone have the idea regarding this issue? Thanks alot

Krishna Gupta
  • 179
  • 3
  • 15
  • 1
    Possible duplicate of [Laravel Session always changes every refresh / request in Laravel 5.4](https://stackoverflow.com/questions/42769388/laravel-session-always-changes-every-refresh-request-in-laravel-5-4) – Bilal Ahmed Oct 30 '17 at 07:28

1 Answers1

0

Please make sure your storage directory has a permission of 755 . Laravel stores its session keys to a file by default ( see .env file SESSION_DRIVER=file )

Giving Laravel permission to write to that directory is important if you are using file system as session storage.

Usually, sessions are saved in /storage/framework/sessions

You can also use redis , memcached or even database as session driver. See https://laravel.com/docs/5.5/session#driver-prerequisites

tintinboss
  • 672
  • 1
  • 7
  • 25