diff options
author | Kevin Lyda <kevin@ie.suberic.net> | 2018-10-21 15:34:30 +0100 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2018-10-21 15:34:30 +0100 |
commit | c5ec176a1cfba4f170991ca7bf6296185b10f565 (patch) | |
tree | 666f937d7a9e8fb225b60d0efb7b40d6fac25497 /server/handlers.go | |
parent | c82e7ee1d46a67f686f1d00aa35e7594b31022d5 (diff) |
Gitlab auth issue (#79)
* Fix the gitlab oauth issue.
* Update for gitlab 11.1+
Versions beyond 11.1 (and possibly a few releases before) use a
different method for delivering tokens. They also have disabled
version 3 of the api.
These changes address that and add a debugging mode for the server
that make it easier to debug issues like this in the future.
* Cleanup of PR.
Updated README. Removed code duplication.
Diffstat (limited to 'server/handlers.go')
-rw-r--r-- | server/handlers.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/server/handlers.go b/server/handlers.go index 4d9543b..3f3543e 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -88,6 +88,7 @@ func (a *app) auth(w http.ResponseWriter, r *http.Request) { case "/auth/callback": state := a.getSessionVariable(r, "state") if r.FormValue("state") != state { + log.Printf("Not authorized on /auth/callback") w.WriteHeader(http.StatusUnauthorized) w.Write([]byte(http.StatusText(http.StatusUnauthorized))) break @@ -99,11 +100,13 @@ func (a *app) auth(w http.ResponseWriter, r *http.Request) { code := r.FormValue("code") token, err := a.authprovider.Exchange(code) if err != nil { + log.Printf("Error on /auth/callback: %v", err) w.WriteHeader(http.StatusInternalServerError) w.Write([]byte(http.StatusText(http.StatusInternalServerError))) w.Write([]byte(err.Error())) break } + log.Printf("Token found on /auth/callback, redirecting to %s", originURL) a.setAuthToken(w, r, token) http.Redirect(w, r, originURL, http.StatusFound) default: |