JSON body returns with 403
@@ -1273,8 +1273,9 @@ class Server:
# For auth method "any" we can use either login with cert or password
token = await cert_login(ca_cert_name)
# TODO: if cert does not exist then may try with password
- except api_exception.AuthenticationIsOptional:
- raise web.HTTPForbidden
+ except api_exception.AuthenticationIsOptional as err:
+ msg = str(err)
+ raise web.HTTPForbidden(reason=msg, body=json.dumps({"message": msg}))
except Exception as ex:
msg = str(ex)
raise web.HTTPInternalServerError(reason=msg, body=json.dumps({"message": msg}))
