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
PHP Sending Variables to File_Get_Contents()
Remove First 4 Characters of a String with PHP
How to Check If a User Is Logged-In in PHP
Laravel Eloquent Orm Transactions
Fatal Error: Call to Undefined Function Oci_Connect()
How to Convert Excel File into MySQL Database
Laravel: I Can't Send More Then 2 Variables from Controller to a View
Excel - Getting the Top 5 Data of a Column and Their Matching Title But Produces Duplicates
Check If Value Exists Before Inserting into MySQL Db in a PHP Script
What Does a Leading Zero Do for a PHP Int