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.
Asked
Active
Viewed 4,893 times
2

rus131354
- 348
- 4
- 11
-
1please include all relevant code and a minimum example – Nikos M. Apr 13 '20 at 14:34
1 Answers
15
You need use auth('sanctum')->user(); or auth('sanctum')->check();

rus131354
- 348
- 4
- 11
-
1Also, 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