diff --git a/cmd/login.go b/cmd/login.go index 29237f8f..8b0aba97 100644 --- a/cmd/login.go +++ b/cmd/login.go @@ -88,6 +88,9 @@ func authenticate(c *cli.Context) error { } auth, resp, err := client.Authorization.Login(&req) + if err != nil { + return err + } // If user hits an endpoint other than the // Vela server that can't process request @@ -95,9 +98,6 @@ func authenticate(c *cli.Context) error { if http.StatusUnauthorized < resp.StatusCode { return fmt.Errorf("unable to process request") } - if resp.StatusCode != http.StatusUnauthorized && err != nil { - return err - } // retry authentication in case user requires an OTP code switch resp.StatusCode {