Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Halim's avatar
Level 2

question about: php artisan api:routes

I'm very curious about: when I do: php artisan api:routes

The column Protected Shows always No, but my routes are protected using JWT and working great!

Why I don't see some routes in the example bellow like Protected?

My api routes

$api = app('Dingo\Api\Routing\Router');

$api->version('v1', function ($api) {

    $api->group(['prefix' => 'auth', 'namespace' => 'App\Http\Controllers\Api\Auth'], function ($api) {
         $api->post('login', 'AuthController@login');
        $api->post('forgot-password', 'ForgotPasswordController@getResetToken');
        $api->post('reset-password', 'ResetPasswordController@reset');

        $api->group(['middleware' => 'jwt.auth'], function ($api) {
            $api->post('logout', 'AuthController@logout');
            $api->post('refresh', 'AuthController@refresh');
            $api->post('me', 'AuthController@me');
    });
});

});

0 likes
9 replies
ahmeddabak's avatar

There is no command called api:routes in Laravel. maybe the command is offered by a third party package.

Halim's avatar
Level 2

so Try it:

 php artisan api:routes
Halim's avatar
Level 2

Yes, I'm using Dingo and JWT

ahmeddabak's avatar

Source

The package only detects routes with api.auth as middleware (which is provided by dingo) as protected, you are using another middleware 'jwt.auth' to protect the three routes, and dingo is not detecting it.

Halim's avatar
Level 2

Humm I see, maybe the package detect passport if I'm using it instead of jwt.auth,

Thanks

ahmeddabak's avatar

If this answers your question please mark this post as solved

Please or to participate in this conversation.