Cataract0523's avatar

Login route cant be found (NotFoundHttpException)

I am getting an exception regarding my login url: "exception": "Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException",

<?php

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::group(['prefix' => 'v1'], function () {
    //OPEN ROUTES
    Route::group(['prefix' => 'auth'], function () {
        Route::resource('register', 'API\V1\Auth\RegisterController');
        Route::resource('login', 'API\V1\Auth\LoginController')->except(['destroy']);
    });
    //CLOSED ROUTES
    Route::middleware(['auth:api'])->group(function () {
        Route::group(['prefix' => 'auth'], function () {
            Route::delete('login', 'API\V1\Auth\LoginController@destroy')->name('login.destroy');
        });
        Route::group(['prefix' => 'dropdown'], function () {
            Route::resource('relationship', 'API\V1\Dropdown\RelationshipController');
        });
        Route::group(['prefix' => 'self', 'middleware' => 'scope:self'], function () {
            //    Route::get('me', 'Api\V1\Self\UserController@show')->name('self.user.show');
        });
        Route::resource('address', 'API\V1\AddressController');
        Route::resource('city', 'API\V1\CityController');
        Route::resource('company', 'API\V1\CompanyController');
        Route::resource('contract', 'API\V1\ContractController');
        Route::resource('dependent', 'API\V1\DependentController');
        Route::resource('holder', 'API\V1\HolderController');
        Route::resource('item', 'API\V1\ItemController');
        Route::resource('sale', 'API\V1\SaleController');
        Route::resource('state', 'API\V1\StateController');
        Route::resource('payment-type', 'API\V1\PaymentTypeController');
        Route::resource('payment-method', 'API\V1\PaymentMethodController');
        Route::resource('payment', 'API\V1\PaymentController');
        Route::resource('people', 'API\V1\PeopleController');
        Route::resource('transaction-result', 'API\V1\TransactionResultController');
        Route::resource('referral', 'API\V1\ReferralController');
    });
});


But I can totally find it (login.store) when I run php artisan route:list

|        | DELETE    | api/v1/auth/login                                        | login.destroy                     | App\Http\Controllers\API\V1\Auth\LoginController@destroy                  | api,auth:api |
|        | GET|HEAD  | api/v1/auth/login                                        | login.index                       | App\Http\Controllers\API\V1\Auth\LoginController@index                    | api          |
|        | POST      | api/v1/auth/login                                        | login.store                       | App\Http\Controllers\API\V1\Auth\LoginController@store                    | api          |
|        | GET|HEAD  | api/v1/auth/login/create                                 | login.create                      | App\Http\Controllers\API\V1\Auth\LoginController@create                   | api          |
|        | GET|HEAD  | api/v1/auth/login/{login}                                | login.show                        | App\Http\Controllers\API\V1\Auth\LoginController@show                     | api          |
|        | PUT|PATCH | api/v1/auth/login/{login}                                | login.update                      | App\Http\Controllers\API\V1\Auth\LoginController@update                   | api          |
|        | GET|HEAD  | api/v1/auth/login/{login}/edit                           | login.edit                        | App\Http\Controllers\API\V1\Auth\LoginController@edit                     | api          |

It has been working for quite a while and all of a sudden I started getting that. Any suggestions?

0 likes
6 replies
Cataract0523's avatar

POST localhost/api/v1/auth/login and I am sending a json with email and password. All other routes are working fine

Sinnbeck's avatar

Can you show the code in the store method? Do you perhaps have a redirect in it?

1 like
wafto's avatar

That so rare, maybe cleaning route cache? I don't think this will resolve the issue but giving a try?

Please or to participate in this conversation.