4 months ago

Issue Logging in when storing session in database

Posted 4 months ago by carlosmoreira

Hello all,

I am currently working on a Laravel 5.5 project. I was tasked with changing the session from a file system to the database.

I noticed a passed developer had attempted to run through the steps and for some reason the system was never fully changed to the database for some reason.

But after following the steps on the Laravel Docs, I am getting a 401 Unauthorized error after logging in successfully.

It logs me in and redirects me to the auth protected page, but when it reaches the page it show a 401 unauthorized error.

I did notice that there is some items in the sessions table, but user_id is empty.

I've ran through the following steps:

  • The migrations are set and create.

  • The .env SESSION_Driver has been changed to database and I confirmed the session.php file is reading from the .env variable.

  • I've also cleared the laravel cache and also called "php artisan config:cache"

Also if I change the session back to use the FILE driver, everything works just fine.

Has anyone run into something like this before?


Please sign in or create an account to participate in this conversation.