4

How can Laravel Nova be configured to work with Passport? Currently I can log into my application via the regular /login (using the Auth middleware) route and the Nova administration will accept my authenticated user, however if I attempt to login at /nova, it claims that "These credentials do not match our records."

I have reviewed https://github.com/laravel/nova-issues but have not found a solution.

2 Answers 2

0

I had the same issue. I'm not 100% certain that it is the same as your problem, but I thought I would share since no one has submitted answer.

In my case, I have a setPasswordAttribute mutator on my User model to hash the password on save. Nova already hashes the password so it was being hashed twice. Probably not the best solution, but I just did the following:

/** App\Models\User.php */ ... public function setPasswordAttribute($value) { $password = starts_with($value, '$2y$') ? $value : Hash::make($value); $this->attributes['password'] = $password; } 
Sign up to request clarification or add additional context in comments.

1 Comment

This is not what is being asked. OP is asking how to use Passport (OAuth) to authenticate to Nova. Not how to set their password value.
0

If the User model has ‘setPasswordAttribute’ that hashes the password by default use this in the nova model:

Password::make('Password') ->onlyOnForms() ->creationRules('required', 'string', 'min:6') ->updateRules('nullable', 'string', 'min:6') ->fillUsing(function (NovaRequest $request, $model, $attribute, $requestAttribute) { if (! empty($request->{$requestAttribute})) { $model->{$attribute} = $request[$requestAttribute]; } }), 

1 Comment

This is not what is being asked. OP is asking how to use Passport (OAuth) to authenticate to Nova. Not how to fill a field in the Nova User Detail page.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.