It depends on which authentication tool you use.
The cookie-based authentication tool by default redirects an unauthorized user to / Account / Login and an already authenticated user to / Account / AccessDenied. This behavior can be disabled by setting the AutomaticChallenge flag in the middleware option, because in this case it will simply return an HTTP 401 response when the user does not log in, or 403 when the user logs in but does not fulfill the authorization requirements.
The JWT link will only return status codes 401 or 403.
Other intermediaries may behave differently, depending on which standard they are trying to implement.
source share