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

Naj's avatar
Level 1

These credentials do not match our records

I have an app with laravel in which, I have different users with different roles. I added users manually in my DB (admin and user) but, when I try to login using email and password already recorded in DB, I got : These credentials do not match our records.

Any idea please ?

0 likes
13 replies
topvillas's avatar

Are you using Laravel auth? If you are, then what do you mean you added users manually, with a seed or through tinker?

Naj's avatar
Level 1

yes, I am using auth. I mean I insert them into mysql through the graphical interface. I read somewhere, that I should create a seeder RoleTableSeeder for example to insert

lmxdev's avatar

the probable cause is that the password isn't hashed properly that's why, try to use a seeder instead

4 likes
Naj's avatar
Level 1

@vapenation I should create a seeder for each one : UserTableSeeder, RoleTableSeeder, RoleUserTableSeeder ? I don't have a model called RoleUser so, when I try to create a seeder it's not working, althought I don't know what to put in that model if I create it ?

lmxdev's avatar

@Naj why would you need that model exactly? and yes you should create a Seeder for User and Role

Naj's avatar
Level 1

@vapenation i don't wanna create it. I just want to insert data into "role_user" table, so I thought that i should do it in the same way as User and Role, I mean using seeder. and when I try to create "RoleUserTableSeeder" it says :

[Symfony\Component\Debug\Exception\FatalErrorException] Class 'App\RoleUser' not found

lmxdev's avatar

@Naj ha i understand, your users can have multiple roles that's it? ok then you can create a seeder for the pivot table aswell

lmxdev's avatar

the error you get is because the model 'RoleUser' doesn't exist, you have to create it

avbrowne's avatar

@Naj you don't need a model for the RoleUser seeder, try something like this..

DB::table( 'role_user' )->insert([
    [ 'role_id' => 1, 'user_id' => 1 ],
    [ 'role_id' => 2, 'user_id' => 1 ],
    [ 'role_id' => 1, 'user_id' => 2 ],
]);
Naj's avatar
Level 1

@avbrowne I should put this code in RoleUser seeder ?

Even after doing all of this changes, I still have same error : These credentials do not match our records.

even though when I check database the tables contain data I insert using seeders

dbr's avatar

@Naj

Run php artisan tinker and type bcrypt('whateverYouWantYourPasswordToBe'). Then input the output to your database.

Haven't tried it but I believe that should work flawlessly.

But do take note that in long term it is better to learn how to do it through Seeds and figure out how the models and relations work as soon as possible.

Naj's avatar
Naj
OP
Best Answer
Level 1

The problem was the hashing. I used seeding but this time, the passwords weren't in plaintext. I used : " \Hash::make('passwordadmin') " and it's working

Please or to participate in this conversation.