aboutsummaryrefslogtreecommitdiff
path: root/server/handlers.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/handlers.go')
-rw-r--r--server/handlers.go3
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: