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

catch enedis redirect error (code 500 . no state)

catches error 500 from enedis instead of stopping at missing parameter (state)
parent bb758aaf
No related branches found
No related tags found
No related merge requests found
Pipeline #11584 passed
...@@ -322,6 +322,21 @@ func main() { ...@@ -322,6 +322,21 @@ func main() {
log.Info("WL - EnedisSuccess - Redirect - Redirecting user to Cozy stack") log.Info("WL - EnedisSuccess - Redirect - Redirecting user to Cozy stack")
http.Redirect(w, r, redir, 302) http.Redirect(w, r, redir, 302)
} else { } else {
if len(code) > 0 {
if findItem(statusCodes, code) {
intCode, err := strconv.Atoi(code)
if err != nil {
logRoute("Proxy_error_enedis_redirect")
log.Error("WL - ProxyError - Enedis - Redirect - String to int convert error for status code: ", err)
http.Error(w, http.StatusText(500), 500)
return
}
logRoute("Enedis_redirect_error")
log.Error("WL - EnedisError - Redirect - status code error: ", code)
http.Error(w, http.StatusText(intCode), intCode)
return
}
}
logRoute("Proxy_error_enedis_redirect") logRoute("Proxy_error_enedis_redirect")
log.Error("WL - ProxyError - Enedis - Redirect - Missing parameters in request") log.Error("WL - ProxyError - Enedis - Redirect - Missing parameters in request")
http.Error(w, http.StatusText(500), 500) http.Error(w, http.StatusText(500), 500)
...@@ -504,7 +519,7 @@ func main() { ...@@ -504,7 +519,7 @@ func main() {
clientSecret := "" clientSecret := ""
code := "" code := ""
grantType := "" grantType := ""
scope := "" // scope := ""
redirectUri := *cozyProxyURI + "/redirect-grdf" redirectUri := *cozyProxyURI + "/redirect-grdf"
pce := "" pce := ""
IdToken := "" IdToken := ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment