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

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
parent 67d7b370
No related branches found
No related tags found
No related merge requests found
Pipeline #4990 passed
...@@ -24,7 +24,7 @@ func main() { ...@@ -24,7 +24,7 @@ func main() {
clientId := query.Get("client_id") clientId := query.Get("client_id")
cozyOrigin := query.Get("redirect_uri") // here we use the redirect_uri param to transmit our stack url cozyOrigin := query.Get("redirect_uri") // here we use the redirect_uri param to transmit our stack url
state := query.Get("state") 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) fmt.Println(authReq)
response, err := http.Get(authReq) response, err := http.Get(authReq)
if err != nil { if err != nil {
...@@ -40,7 +40,7 @@ func main() { ...@@ -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() query := r.URL.Query()
fmt.Println(query) fmt.Println(query)
state := strings.Split(query.Get("state"), "-")[0] state := strings.Split(query.Get("state"), "-")[0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment