Use request variables instead of mux
This commit is contained in:
parent
c70ef769a9
commit
3614dc99b2
1 changed files with 5 additions and 5 deletions
|
|
@ -58,15 +58,15 @@ func (a *Auth) register(handler http.HandlerFunc) string {
|
|||
}
|
||||
|
||||
func (a *Auth) handle(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
q := r.URL.Query()
|
||||
|
||||
if error, ok := vars["error"]; ok {
|
||||
if q.Has("error") {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
fmt.Fprintf(w, "error: %s: %s\n", error, vars["error_description"])
|
||||
fmt.Fprintf(w, "error: %s: %s\n", q.Get("error"), q.Get("error_description"))
|
||||
return
|
||||
}
|
||||
|
||||
state, err := util.DecryptState(vars["state"], a.secret)
|
||||
state, err := util.DecryptState(q.Get("state"), a.secret)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
fmt.Fprintf(w, "failed to decrypt state")
|
||||
|
|
@ -80,7 +80,7 @@ func (a *Auth) handle(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
a.mu.Lock()
|
||||
handler := a.routes[vars["state"]]
|
||||
handler := a.routes[q.Get("state")]
|
||||
a.mu.Unlock()
|
||||
|
||||
if handler == nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue