diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/oauth.go | 7 | ||||
-rw-r--r-- | api/user.go | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/api/oauth.go b/api/oauth.go index 9b7f3699d..a7119d7e5 100644 --- a/api/oauth.go +++ b/api/oauth.go @@ -29,11 +29,14 @@ func InitOAuth(r *mux.Router) { sr.Handle("/authorize", ApiUserRequired(authorizeOAuth)).Methods("GET") sr.Handle("/access_token", ApiAppHandler(getAccessToken)).Methods("POST") - // Also handle this a the old routes remove soon apiv2? mr := Srv.Router mr.Handle("/authorize", ApiUserRequired(authorizeOAuth)).Methods("GET") mr.Handle("/access_token", ApiAppHandler(getAccessToken)).Methods("POST") + + // Handle all the old routes, to be later removed mr.Handle("/{service:[A-Za-z]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET") + mr.Handle("/signup/{service:[A-Za-z]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET") + mr.Handle("/login/{service:[A-Za-z]+}/complete", AppHandlerIndependent(completeOAuth)).Methods("GET") } func registerOAuthApp(c *Context, w http.ResponseWriter, r *http.Request) { @@ -185,7 +188,7 @@ func completeOAuth(c *Context, w http.ResponseWriter, r *http.Request) { code := r.URL.Query().Get("code") state := r.URL.Query().Get("state") - uri := c.GetSiteURL() + "/api/v1/oauth/" + service + "/complete" + uri := c.GetSiteURL() + "/signup/" + service + "/complete" if body, team, props, err := AuthorizeOAuthUser(service, code, state, uri); err != nil { c.Err = err diff --git a/api/user.go b/api/user.go index 6803a946c..43969158a 100644 --- a/api/user.go +++ b/api/user.go @@ -1938,7 +1938,7 @@ func GetAuthorizationCode(c *Context, service, teamName string, props map[string props["team"] = teamName state := b64.StdEncoding.EncodeToString([]byte(model.MapToJson(props))) - redirectUri := c.GetSiteURL() + "/api/v1/oauth/" + service + "/complete" + redirectUri := c.GetSiteURL() + "/signup/" + service + "/complete" authUrl := endpoint + "?response_type=code&client_id=" + clientId + "&redirect_uri=" + url.QueryEscape(redirectUri) + "&state=" + url.QueryEscape(state) |