[Sanctum] Get authenticated user data without auth:sanctum middleware
Hi, I use Sanctum v4.0.3 and I can't get authenticated user data without auth:sanctum middleware,
I already have Accept:application/json,Origin:'' in headers. I think I did everything in the documentation or maybe I missed something?
@vincent15000 yeah, users authenticated with sanctum and I have an api for which a user can be either authorized or unauthorized. I read official laravel doc
It can be done using sanctum guard: $user = auth('sanctum')->user();. If correct credentials are provided (token or cookie) it will return the authenticated user and if not - null will be returned.