Home » Php » Laravel 5 Auth: These credentials do not match our records

Laravel 5 Auth: These credentials do not match our records

Posted by: admin November 29, 2017 Leave a comment


I’m just starting out with Laravel 5, I come from Laravel 4 environment so it shouldn’t be too hard.

I heard L5 comes with a built-in authentication system which is neat.
I’ve set everything up from database to views.

The registration process is working correctly and after that it logs me in automatically. but when I log out and try to log back in, I get this error:

These credentials do not match our records.

I’m not sure what’s wrong. do I have to write the login controller manually or how does it work in L5?


I had the same issue. The reason for mine was that
I defined setPasswordAttribute in my User model so every time, I enter plain password, it hashes before sending to DB.

public function setPasswordAttribute($password)
    $this->attributes['password'] = \Hash::make($password);

and in my db:seed, I was creating a user with hashed password with Hash::make("password"), too. So laravel hashes hashed password 🙂

In laravel version 5.* you don’t need to hash input password for Auth, because Auth manages it itself. you just have to pass {{csrf_field()}} through form.


In addition to @mervasdayi solution, a good way to hash passwords in setPasswordAttribute avoiding rehashing problems could be this:

public function setPasswordAttribute($password){
    $this->attributes['password'] = Hash::needsRehash($password) ? Hash::make($password) : $password;


Further to what @mervasdayi & Gerard Reches have suggested. Just thought I’d make a note that you will need to include

use Illuminate\Support\Facades\Hash;

at the top of your User model when adding in these fixes.