Skip to content
Advertisement

Auth::attempt($credentials) Always returns false in Laravel 8.76.2

I’m using Auth::attempt($credentials) in Laravel 8.7, it always returns false.

My Login Blade Is

resources/views/login/login.blade.php

JavaScript

Router

JavaScript

My Controller code is like this – I’m accessing the controller using a router

LoginController.php

JavaScript

When I’m using Auth::attempt($credentials), returning always a false statement. Please help me to find out the actual problem or suggest me best solution. I have tried many combinations to solve this problem but still not working.

This is my table structure

This is output

Advertisement

Answer

You need to hash the password in the database. The authentication system is expecting the password to be hashed in the database. It will do a hash check against the plain text version (user submitted value) and the hashed password from the database.

“If the user is found, the hashed password stored in the database will be compared with the password value passed to the method via the array.”

Laravel 8.x Docs – Authentication – Manually Authenticating Users

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement