Answer the question
In order to leave comments, you need to log in
How to fix Laravel authorization error?
I'm trying to authorize, but when I try to authenticate, I get an error: Error
text: Undefined index: password in file C:\OSPanel\domains\wsr.ru\vendor\laravel\framework\src\Illuminate\Auth\EloquentUserProvider.php on line 143
The authorization code itself
protected function login(Request $data) {
if (Auth::attempt(['phone' => $data['phone'], 'passhash' => md5($data['password'])])) {
return response()->json(array('token' => 'Вы успешно авторизировались!'), 200);
} else {
return response()->json([
'error' => 'Incorrect phone or password',
], 404);
}
}
Answer the question
In order to leave comments, you need to log in
To begin with, it is worth remembering that this is not authorization, but authentication.
Next, you should start learning English or acquire the minimum skills of using Google translator.
In parallel, you need to read the Laravel documentation.
And what is this horror? What is wrong with the built-in authentication mechanism described in the documentation?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question