Laravel Passport: use api guard for passport specific routes - development

Laravel Passport: use api guard for passport specific routes

I’m writing a REST API using laravel (5.6) and passport. In the documentation it says that it’s possible to use the json api for making passport specific requests (for example to get tokens, create or edit clients etc).
(https://laravel.com/docs/5.6/passport#managing-clients)

However when I want to use these passport routes in my angular frontend using the REST interface, y get “Unauthenticated” errors, also while using the correct access token.

I searched the passport classes (mainly RouteRegistrar) and found that they always use the web guard.
How to solve this?

I searched if it’s possible to configure the Passport::routes() in some way but did not find anything in the docs. So is the only solution not using the Passport::routes(); and writing custom routes with auth:api middleware instead of auth:web?



from Laravel Questions and Answers https://laravelquestions.com/php/laravel-passport-use-api-guard-for-passport-specific-routes/
via Lzo Media

Comments

Popular posts from this blog

ng-show doesn’t work correct with value boolean

Using PHP and MySQL data to generate PDF letters like in MS Word mailmerge functionality - development

ng-include of inline SVG does not display gradient except in Chrome