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

jmurphy1267's avatar

Passport Api routes

I am working on building out my api for my website that will eventually have a iPhone app with it. I have come to the part were I need to make an api method that will log a user in and send back a grant token that can be used for making calls. Currently I have laravel 5.7 and passport installed.

 Route::group(['prefix' => '/v1', 'middleware' => ['auth:api'], 'namespace' => 'Api\V1', 'as' => 'api.'], function () {
        Route::post('/post/like','PostLikeController@store');

});
Route::group(['prefix' => '/v1', 'namespace' => 'Api\V1', 'as' => 'api.'], function () {
        Route::post('login', 'Auth\LoginController@login');
});

Above are the routes and when I go to the login rout I get an unauthenticated message no matter what middleware I try to put on it. I am testing this route in postman right now and if I do not send a header of accept I get the login page but once I put accept header on the request I get the unauthenticated message. Any help would be wonderful.

I need the login route to work with out authentication since it will be used to sign users in on the iPhone and send a password grant token.

When I call login route I get this

{
     "message": "Unauthenticated."
 }
0 likes
2 replies

Please or to participate in this conversation.