From 80edb3d5e05bf109b4f5ffde977f1f629035955c Mon Sep 17 00:00:00 2001 From: Hugo <hnouts@grandlyon.com> Date: Wed, 22 Apr 2020 18:39:22 +0200 Subject: [PATCH] removed /redirect endpoint because so far enedis point towards "/" if it's not working, try to modify the app spec in enedis admin panel to point to add /redirect in the redirect_uri --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index debc661..7d4e881 100644 --- a/main.go +++ b/main.go @@ -24,7 +24,7 @@ func main() { clientId := query.Get("client_id") cozyOrigin := query.Get("redirect_uri") // here we use the redirect_uri param to transmit our stack url state := query.Get("state") - authReq := "https://gw.hml.api.enedis.fr/group/espace-particuliers/consentement-linky/oauth2/authorize?client_id="+ clientId +"&duration=P6M&redirect_uri=https://oauth-proxy.wf.alpha.grandlyon.com/redirect&response_type=code&state="+ state +"-"+ cozyOrigin + authReq := "https://gw.hml.api.enedis.fr/group/espace-particuliers/consentement-linky/oauth2/authorize?client_id="+ clientId +"&duration=P6M&redirect_uri=https://oauth-proxy.wf.alpha.grandlyon.com/&response_type=code&state="+ state +"-"+ cozyOrigin fmt.Println(authReq) response, err := http.Get(authReq) if err != nil { @@ -40,7 +40,7 @@ func main() { }) - mux.HandleFunc("/redirect", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { query := r.URL.Query() fmt.Println(query) state := strings.Split(query.Get("state"), "-")[0] -- GitLab