I'm using Laravel as API with Passport Password Grant Token and specific user guards for different SPA frontends (foo.com, bar.com).
I'm setting the forgot-password' route as per the doc:
Route::post('foo/forgot-password', function (Request $request) {
$request->validate(['email' => 'required|email']);
$status = Password::sendResetLink(
$request->only('email')
);
return $status === Password::RESET_LINK_SENT
? back()->with(['status' => __($status)])
: back()->withErrors(['email' => __($status)]);
})->middleware('guest')->name('password.email');
But when I my SPA frontend calls this method, I get the following error in Laravel:
local.ERROR: Route [password.reset] not defined. {"exception":"[object] (Symfony\Component\Routing\Exception\RouteNotFoundException(code: 0): Route [password.reset] not defined. at /Users/me/code/my-api/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:429)
Knowing that my api has different set of users with given guard, how to deal with the password.reset route which should be different according to the frontend (and the set of users or guard associated) ?