I'm trying to add authentication to my api using laravel sanctum. My test route is:
Route::middleware('auth:sanctum')->get('/test', function () { return 'API OK'; });
This return "API OK" when authenticated. That's ok, but also adds additional information in html format. I only need the response. What am I missing here?
This is a succesful case:

When token is invalid I'm rediredted to the login page. I just need the 401 error:
