Answer the question
In order to leave comments, you need to log in
Laravel 5.6 how to check if the user is authorized on the site when sending a request through the API?
Can you please tell me how in Laravel 5.6 you can check if the user is authorized on the site when he sends a request through the API? That is, before "auth: api" authorizes the user by token, check whether he is authorized on the site.
Answer the question
In order to leave comments, you need to log in
It turned out in the comments that all this looks very strange, but okay ...
Well, a simple solution seems to be as follows: authenticated through auth:api
, caught the Authenticated event, and tried to authenticate by auth:web
. It turned out - everything is fine. Didn't work - not great.
Well, you can check the identity of users after both attempts, such as
\Auth::guard('api')->user()->is(\Auth::guard('web')->user());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question