@edtheduck the default implementation of the unauthenticated method is this one:
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return redirect()->guest('login');
}
Which means the check happens within the method if it is a JSON or not a JSON request. Now when you override it, it means that you always respond with JSON.
And from the overridden method you are not calling the parent class method in order to respond with a redirect to the login route.
So check if you've got the correct import for the exception:
use Illuminate\Auth\AuthenticationException;
And make sure that it hits this method. Or check where else you use route('login');