From e7de7703ab029fa49754f280230276d98ba5811d Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Mon, 25 Feb 2019 20:09:43 +0100 Subject: [PATCH] Log mismatched state --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 93a21db..6bb1d1b 100644 --- a/main.go +++ b/main.go @@ -115,10 +115,12 @@ func (*authHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } } else if r.URL.Path == "/auth/callback" { - code := r.FormValue("code") - state := r.FormValue("state") + log.Printf("%+v\n", sess) + code := r.URL.Query().Get("code") + state := r.URL.Query().Get("state") if state != sess.State { + log.Printf("mismatched state: %s != %s", state, sess.State) http.Error(w, "mismatched state", 500) return }