2

How I can get or check auth user without auth:sanctum. I try get auth user auth()->user() from guest route but I get only null. And yes I pass token but still get null nested user. But if I try with route inside auth:sanctum all ok.

rus131354
  • 348
  • 4
  • 11

1 Answers1

15

You need use auth('sanctum')->user(); or auth('sanctum')->check();

rus131354
  • 348
  • 4
  • 11
  • 1
    Also, you can modify your `auth` config by changing the `driver` value of `guards.api`. This way it will be the default guard on all API routes. – Nergal Aug 10 '20 at 10:40