diff --git a/cozy-oauth-proxy b/cozy-oauth-proxy index fc7a914ff47d4c8f53c8280afec8cd395e2ce758..6468dd2954e8651fd15fab17b787f9f826467053 100755 Binary files a/cozy-oauth-proxy and b/cozy-oauth-proxy differ diff --git a/main.go b/main.go index 8c673d323ebc7fe6cf325ec8eb8f5916257dff73..8d184d05ab97cea4fe40ccc4e5fa562d001a4b36 100644 --- a/main.go +++ b/main.go @@ -15,8 +15,9 @@ import ( ) var ( - httpPort = flag.Int("http_port", LookupEnvOrInt("HTTP_PORT", 80), "HTTP port to serve on (defaults to 80)") - logLevel = flag.String("loglevel", LookupEnvOrString("LOGLEVEL", "debug"), "log level (debug, info, warning, error) (defaults to debug)") + httpPort = flag.Int("http_port", LookupEnvOrInt("HTTP_PORT", 80), "HTTP port to serve on (defaults to 80)") + logLevel = flag.String("loglevel", LookupEnvOrString("LOGLEVEL", "debug"), "log level (debug, info, warning, error) (defaults to debug)") + redirectURI = flag.String("redirect_uri", LookupEnvOrString("REDIRECT_URI", "https://oauth-proxy.wf.alpha.grandlyon.com/redirect"), "Redirect URI (defaults to https://oauth-proxy.wf.alpha.grandlyon.com/redirect)") ) type TokenResponse struct { @@ -92,7 +93,6 @@ func main() { clientId := query.Get("client_id") state := query.Get("state") cozyOrigin := query.Get("redirect_uri") // here we use the redirect_uri param to transmit our stack url - redirectUri := "https://oauth-proxy.wf.alpha.grandlyon.com/redirect" responseType := "code" // DEV API @@ -100,7 +100,7 @@ func main() { // PROD API authURL := "https://mon-compte-particulier.enedis.fr/dataconnect/v1/oauth2/authorize" - redirectUrl := authURL + "?client_id=" + clientId + "&duration=P6M&redirect_uri=" + redirectUri + "&response_type=" + responseType + "&state=" + state + "-" + cozyOrigin + redirectUrl := authURL + "?client_id=" + clientId + "&duration=P6M&redirect_uri=" + *redirectURI + "&response_type=" + responseType + "&state=" + state + "-" + cozyOrigin log.Debug("Redirect to - ", redirectUrl) http.Redirect(w, r, redirectUrl, 302)