Check if grant_type is used in token_endpoint

This commit is contained in:
Peter Stuifzand 2018-07-25 13:51:00 +02:00
parent de9e27cac4
commit 06a8df3bb8

View File

@ -559,7 +559,12 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, redirectURI.String(), 302) http.Redirect(w, r, redirectURI.String(), 302)
return return
} else if r.URL.Path == "/auth/token" { } else if r.URL.Path == "/auth/token" {
//grantType := r.FormValue("grant_type") grantType := r.FormValue("grant_type")
if grantType != "authorization_code" {
w.WriteHeader(400)
fmt.Fprintf(w, "ERROR: grant_type is not set to %q", "authorization_code")
return
}
code := r.FormValue("code") code := r.FormValue("code")
//clientID := r.FormValue("client_id") //clientID := r.FormValue("client_id")
//redirectURI := r.FormValue("redirect_uri") //redirectURI := r.FormValue("redirect_uri")