I'm creating a login api in Laravel.
I have a login method
public function authenticate(Request $request)
{
$credentials = $request->only('email', 'password');
if (Auth::attempt($credentials)) {
return response()->json(auth()->user());
} else {
}
return Response::json(['message' => 'Failed to authenticate'], 401);
}
If the login fails it doesn't reach the 401 error. Any reason why?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2HLYC2a
via IFTTT
Aucun commentaire:
Enregistrer un commentaire