Log mismatched state

This commit is contained in:
Peter Stuifzand 2019-02-25 20:09:43 +01:00
parent 12f65072f2
commit e7de7703ab

View File

@ -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
}