diff --git a/main.go b/main.go index 6ca688ea6b4a589d32f62bd673de4a39228a1efe..82732d17464c428aa4c3312fa0f1e2f610785877 100644 --- a/main.go +++ b/main.go @@ -14,13 +14,14 @@ var ( func main() { // Parse the flags 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.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { query := r.URL.Query() - state := strings.Split(query.Get("state"), "-")[0] - host := r.Host - redir := "http://" + host + state + host := strings.Split(query.Get("state"), "-")[0] + usagePointId := query.Get("usage_point_id") + code := query.Get("code") + redir := "http://" + host + "?code=" + code + "&usage_point_id=" + usagePointId http.Redirect(w, r, redir, 302) })