Route [Login] Not Defined

Route [login] not defined

You're trying to redirect to a named route whose name is login, but you have no routes with that name:

Route::post('login', [ 'as' => 'login', 'uses' => 'LoginController@do']);

The 'as' portion of the second parameter defines the name of the route. The first string parameter defines its route.

laravel 8 auth Route [login] not defined

You are missing the login route which is used to display the login form. Try naming your root:

Route::get('/', function () {
return view('login');
})->name('login');

Or you can add a separate route depending on what you are looking for.

Route::get('login', [UserLogin::class, 'showLoginForm'])->name('login');

How to fix this error Symfony\Component\Routing\Exception\RouteNotFoundException: Route [login] not defined. in laravel 8?

Mostly, I think, this error often occurs when a route protected by a middleware is being accessed by an unauthorized/unauthenticated resource. I think you should check if the jwt token is valid by removing the auth:api middleware and replace it with this:

return response()->json([ 'valid' => auth()->check() ]);



Related Topics



Leave a reply



Submit