diff --git a/prow/githuboauth/githuboauth.go b/prow/githuboauth/githuboauth.go index ac96023f06a7..8a57f23b6da5 100644 --- a/prow/githuboauth/githuboauth.go +++ b/prow/githuboauth/githuboauth.go @@ -173,7 +173,19 @@ func (ga *GithubOAuthAgent) HandleRedirect(client OAuthClient, getter GithubClie code := r.FormValue("code") token, err := client.Exchange(context.Background(), code) if err != nil { - ga.serverError(w, "Exchange code for token", err) + if gherror := r.FormValue("error"); len(gherror) > 0 { + gherrorDescription := r.FormValue("error_description") + gherrorURI := r.FormValue("error_uri") + fields := logrus.Fields{ + "gh_error": gherror, + "gh_error_description": gherrorDescription, + "gh_error_uri": gherrorURI, + } + ga.logger.WithFields(fields).Error("GitHub passed errors in callback, token is not present") + ga.serverError(w, "OAuth authentication with GitHub", fmt.Errorf(gherror)) + } else { + ga.serverError(w, "Exchange code for token", err) + } return }