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

ajtrichards's avatar

L4.3 / L5 - Authentication doesn't save user session

I've just installed a fresh version of Laravel 4.3/5 and i've setup my /auth/login view and that appears fine when I attempt to access - http://HOSTNAME/home (I get redirected to http://HOSTNAME/auth/login

Attempting to login with incorrect credentials produces "These credentials do not match our records." which i'm expecting. When I enter the correct Username and Password it looks as though i've been authenticated and the URL moves to http://HOSTNAME/home but as soon as the auth middleware is run i'm sent back to the Login screen.

Have I missed something out? My Database and Cache / Session has all be configured correctly.

0 likes
5 replies
bashy's avatar

Question is, what are your session settings set like? Have you done any testing of if sessions get saved in database/storage?

ajtrichards's avatar

Hi Bashy,

I'm using Memcached for the session - i've saved some data in a session. This has saved and can be retrieved (I saved a timestamp to prove that it was persisting historic data).

I'm using the MySQL connection for DB. I can also access the User model with Eloquent and run User::all(); and see all the users.

bashy's avatar

Not used Memcached for session before but have you tried to return the auth data as soon as you login? Then maybe have another page that just returns the auth data without a middleware?

ajtrichards's avatar

Yeah i tried to return auth details on a page without auth middleware and nothing is returned.

I removed the password to the DB connection and I get an error message so the DB is working fine. Strange.

bashy's avatar

Checked it's only doing it when using Memcached? Have you tested it with file/database drivers for session?

Please or to participate in this conversation.