'Target [Laravel\Fortify\Contracts\ResetsUserPasswords] is not instantiable
I am implementing the forgot password / password reset logic with Laravel 8 and Fortify for an SPA application.
When the /reset-password is called and if the data are all correct (email, password, password_confirmation, token), I get a server side error:
Target [Laravel\Fortify\Contracts\ResetsUserPasswords] is not instantiable.
The route is defined as follows in api.php:
Route::post('/reset-password', [NewPasswordController::class, 'store']);
Thanks for your help
Solution 1:[1]
I had the same issue in my API and I was able to resolve it.
Target [Laravel\Fortify\Contracts\ResetsUserPasswords] is not instantiable.
Laravel\Fortify\Contracts\ResetsUserPasswords
is an interface, and Fortify (by default) has implemented the ResetsUserPassword Action which implements the interface.
All you need to get it working is to ensure this class App\Providers\FortifyServiceProvider::class
is registered within the providers
array of your application's config/app.php
configuration file.
// ...
App\Providers\FortifyServiceProvider::class,
Solution 2:[2]
You need to register views, thats why this error is throwing. I was able to fix the issue by doing this.
Document: https://laravel.com/docs/8.x/fortify#registration
Please check this thread: target [Laravel\Fortify\Contracts\RegisterViewResponse] is not instantiable
Fortify::registerView(function () {
return view('auth.register');
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Joseph Ajibodu |
Solution 2 | Kalana Perera |