From 18870a479c57e0007e976352e0281e773f69635f Mon Sep 17 00:00:00 2001 From: Hugo SUBTIL <ext.sopra.husubtil@grandlyon.com> Date: Tue, 3 Mar 2020 11:53:42 +0100 Subject: [PATCH] Update main.go --- main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 6ca688e..82732d1 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) }) -- GitLab