How to check password without using Auth in Laravel

Harshit Vaid
May 28, 2019 · 1 min read

Hello Guys!

I am here with another interesting blog about Laravel. Many Users uses the Auth Package to authenticate users. Auth package consists of all the basic functionality like Login, Register and Forgets Password to uses But in some situations, we need to authenticate the user's password without using auth package. So in this story, I will discuss how we can authenticate the users without the help of auth.

One more thing if you are beginners then I will tell you that the Laravel uses the hash generated passwords for the users for securities reasons. Let’s start the story :

I assumed that you have created the user's table and created the user’s model.

Create a function in the controller file like below code:

public function checkUserPassword(Request $request){
$userPwd = $request->managerpwd;
$userName = $request->manageruser;

$user = User::where('id', $userName)->first();
$passwordCheck = \Hash::check($userPwd, $user->password);
$output = ['success' => 1,
'msg' => 'Details matched successfully'
$output = [
'success' => 0,
'msg' => 'Something went wrong. Details not matched'
return $output;

Here we have used Hash::check method for authenticating the user

This method will return true or false in the response.

I hope the above article will help you to solve the users.

Happy Coding :)

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store