@adityar15 remove the label from the details array and try it.
Jan 21, 2021
5
Level 2
Laravel Auth showing wrong user
I am trying to log in to the user using API. The API request is over curl as I am using Livewire.
The authentication works perfectly on a web app (the one having API code) but it does not work when called from another project. It shows the wrong user details instead of the authenticated user.
Here is the code
$details = [
'label'=>'Customer',
'email'=>$request->email,
'password'=>$request->password,
];
if(Auth::guard('web')->attempt($details, $request->remember_me))
{
//do some processing
return response()->json([
'status' => 200,
'data' => $data
]);
}
The array keys are exactly as per the database column. Could someone please help? What I am doing wrong?
Please or to participate in this conversation.