Are you sure you are signed in https://laravel.com/docs/8.x/sanctum#logging-in
Jan 18, 2022
16
Level 1
/api/user, redirect me to home page
I have This route in my api.php
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
return $request->user();
});
but when I try to access to /api/user it redirect me to home page, why ?
Level 61
How did you make the request? If through the browser then you are probably not sending proper headers. Try doing it through Postman or similar tools and add Accept: application/json.
1 like
Please or to participate in this conversation.
