R
R
Roman2019-04-07 16:30:30
Laravel
Roman, 2019-04-07 16:30:30

Auth::attempt requires me to specify a password - how to get rid of this?

Hello.
I am doing custom authentication for Laravel now. I don't need a password, only 'name'.
But when I try to authenticate via Auth::attempt, it tells me that I need a password.
I tried to pass an empty password (null as in the database) - does not help - Auth::attempt returns false without comments.
And in general, I would like to do it without crutches like empty passwords in logic.
Googled. I tried to make my own provider - it doesn't work.
How can I get rid of the password check in Auth::attempt?
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Pushkarev, 2019-04-07
@AXP-dev

What's wrong with Auth::loginUsingId or Auth::login ?

J
JhaoDa, 2019-04-07
@JhaoDa

Because you haven't dealt with the guards and user providers, as I advised you in the last question.

How can I get rid of the password check in Auth::attempt?
Create your own user provider. attempthe does nothing himself, he passes an array of data (login / password / token / full name / whatever) the user to the provider, who already knows what to do with it and how to check it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question