diff --git a/backend/plugins/zentao/models/access_token.go b/backend/plugins/zentao/models/access_token.go index 60bf2617878..d084348fbb1 100644 --- a/backend/plugins/zentao/models/access_token.go +++ b/backend/plugins/zentao/models/access_token.go @@ -24,4 +24,5 @@ type ApiAccessTokenRequest struct { type ApiAccessTokenResponse struct { Token string `json:"token"` + Error string `json:"error"` } diff --git a/backend/plugins/zentao/models/connection.go b/backend/plugins/zentao/models/connection.go index ccce2010e32..0554450e7ae 100644 --- a/backend/plugins/zentao/models/connection.go +++ b/backend/plugins/zentao/models/connection.go @@ -50,7 +50,11 @@ func (connection ZentaoConn) PrepareApiClient(apiClient plugin.ApiClient) errors return errors.HttpStatus(http.StatusBadRequest).Wrap(err, "failed UnmarshalResponse for tokenResBody") } if tokenResBody.Token == "" { - return errors.HttpStatus(http.StatusBadRequest).New("failed to request access token") + msg := "failed to request access token" + if tokenResBody.Error != "" { + msg = tokenResBody.Error + } + return errors.HttpStatus(http.StatusBadRequest).New(msg) } apiClient.SetHeaders(map[string]string{ "Token": fmt.Sprintf("%v", tokenResBody.Token),