summaryrefslogtreecommitdiffstats
path: root/api/oauth.go
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2016-03-24 19:32:25 -0400
committerJoramWilander <jwawilander@gmail.com>2016-03-24 19:32:25 -0400
commitde2f7f4e529e697c07bb786bd099683d746044d2 (patch)
treefc5959dcf39c949cce06b65210b0c41ad098aebd /api/oauth.go
parent8f5b90fe7858de03ac055b38ab7aaec5f54fa107 (diff)
downloadchat-de2f7f4e529e697c07bb786bd099683d746044d2.tar.gz
chat-de2f7f4e529e697c07bb786bd099683d746044d2.tar.bz2
chat-de2f7f4e529e697c07bb786bd099683d746044d2.zip
Fix oauth routes and link issues
Diffstat (limited to 'api/oauth.go')
-rw-r--r--api/oauth.go7
1 files changed, 5 insertions, 2 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