When a generic authenticator endpoint returns status code 401 or 403, heimdall responds with a communication error (502). However, those code are used by the endpoints to indicate that verification of the credentials failed.
So, those status codes should be translated to authentication errors instead.
Originally posted by @Kakadus in #2805