Skip to content
Snippets Groups Projects
Commit 18870a47 authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

Update main.go

parent 5c5e01c8
Branches
No related tags found
No related merge requests found
Pipeline #4157 failed
...@@ -14,13 +14,14 @@ var ( ...@@ -14,13 +14,14 @@ var (
func main() { func main() {
// Parse the flags // Parse the flags
flag.Parse() flag.Parse()
https://oauth-proxy.cozy.wf.alpha.grandlyon.com/?code=SEUb2TQEjqOe8sImX5dQNyIhb3YmyK&state=hugo.pchugo.wf.cozy.alpha.grandlyon.com&usage_point_id=22516914714270
mux := http.NewServeMux() mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query() query := r.URL.Query()
state := strings.Split(query.Get("state"), "-")[0] host := strings.Split(query.Get("state"), "-")[0]
host := r.Host usagePointId := query.Get("usage_point_id")
redir := "http://" + host + state code := query.Get("code")
redir := "http://" + host + "?code=" + code + "&usage_point_id=" + usagePointId
http.Redirect(w, r, redir, 302) 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