Skip to content
Snippets Groups Projects
Commit ce1a3c4f authored by Hugo NOUTS's avatar Hugo NOUTS
Browse files

error 500 bad state

trying to inject /accounts/service-name/redirect in the construction of the redirect uri instead of polluting state with it
parent f6d7cb63
No related branches found
No related tags found
No related merge requests found
Pipeline #4933 failed
......@@ -19,7 +19,8 @@ func main() {
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
fmt.Println(query)
host := strings.Split(query.Get("state"), "-")[1]
// host := strings.Split(query.Get("state"), "-")[1]
host := query.Get("state")
fmt.Println(host)
state := query.Get("state")
fmt.Println(state)
......@@ -27,7 +28,7 @@ func main() {
fmt.Println(usagePointId)
code := query.Get("code")
fmt.Println(code)
redir := "https://" + host + "?code=" + code + "&state="+ state +"&usage_point_id=" + usagePointId
redir := "https://" + host + "/accounts/enedisoauth/redirect?code=" + code + "&state="+ state +"&usage_point_id=" + usagePointId
fmt.Println(redir)
http.Redirect(w, r, redir, 302)
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment