From d554b447600936df7f1ca8d9ad7f09a66e8c16ce Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Sun, 3 Aug 2014 14:25:16 +0600 Subject: [PATCH] 0.3, Forming right redirect url for enterprise This fixes redirect loop for github enterprise users. But I still got `Error retrieving currently authenticated GitHub user. Unauthorized` error. --- plugin/remote/github/github.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/remote/github/github.go b/plugin/remote/github/github.go index e55c7f7b7..9f39e6efc 100644 --- a/plugin/remote/github/github.go +++ b/plugin/remote/github/github.go @@ -142,7 +142,7 @@ func (g *Github) GetPullRequestHook(r *http.Request) (*remote.Hook, error) { func (g *Github) GetLogin(w http.ResponseWriter, r *http.Request) (*remote.Login, error) { // create the oauth2 client oauth := oauth2.Client{ - RedirectURL: fmt.Sprintf("%s://%s/login/github.com", httputil.GetScheme(r), httputil.GetHost(r)), + RedirectURL: fmt.Sprintf("%s://%s/login/%s", httputil.GetScheme(r), httputil.GetHost(r), g.GetName()), AccessTokenURL: fmt.Sprintf("%s/login/oauth/access_token", g.URL), AuthorizationURL: fmt.Sprintf("%s/login/oauth/authorize", g.URL), ClientId: g.Client,