Answer the question
In order to leave comments, you need to log in
How to competently make access to a group of routes (for api) only for authenticated users, without using the 'auth' middleware?
There is a group of routes for api, which should be given access only to authenticated users. And guests can simply give json with an invitation to authenticate.
Writing Auth::check() in every function is not an option.
middleware 'auth' redirects to /login and in general, as I understand it, not for api.
What's the best thing to do? Just your middleware and hang it on a group of routes?
Or are there any other lara-way options? ))
Answer the question
In order to leave comments, you need to log in
https://laravel.com/docs/8.x/passport#introduction
https://laravel.com/docs/8.x/sanctum
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question