8 months ago

Passport API: Understanding how it works

Posted 8 months ago by abkrim

I am trying to make up the way to work with Laravel 6 and Passport and I am crashing into the most essential

At the moment without authentication I can work.

Route :: get ('users', 'Api\[email protected]')

If I send a post method, to localhost/api/users in Postman with the required data and it is validated it works for me.

But I don't use any authtentication.

But now my doubts come that I can't clarify and I feel frustrated.

Well my application should have two access possibilities:

The user uses user credentials based on the public and private key model

The Administrator, I understand that in development you can use the tokens generated when installing passport

Now hay tried use

Route::middleware('auth:api')->group( function() {
    Route::resource('users', 'Api\UserController');

If tried create on postman a new user get error.

Symfony\Component\Routing\Exception\RouteNotFoundException: Route [login] not defined. in file /home/abkrim/albarid/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 389

My dismissal is total, because I fail to understand how you work with Passport.

Please sign in or create an account to participate in this conversation.