From 5185481bffc0ad330c643353db7d9a24e046dbf3 Mon Sep 17 00:00:00 2001
From: Yoan VALLET <ext.sopra.yvallet@grandlyon.com>
Date: Wed, 27 May 2020 09:25:51 +0200
Subject: [PATCH] Switch to DEV API for tests

---
 main.go | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/main.go b/main.go
index 7a3a928..53d5ede 100644
--- a/main.go
+++ b/main.go
@@ -45,7 +45,12 @@ func main() {
 		redirectUri := "https://oauth-proxy.wf.alpha.grandlyon.com/redirect"
 		responseType := "code" 
 
-		redirectUrl := "https://mon-compte-particulier.enedis.fr/dataconnect/v1/oauth2/authorize?client_id="+ clientId +"&duration=P6M&redirect_uri="+ redirectUri +"&response_type="+ responseType +"&state="+ state +"-"+ cozyOrigin
+		// DEV API
+		authURL := "https://gw.hml.api.enedis.fr/dataconnect/v1/oauth2/authorize"
+		// 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
 
 		fmt.Println(time.Now().Format("2006-01-02 15:04:05"), "- Redirect to - ", redirectUrl)
 		http.Redirect(w, r, redirectUrl, 302)
@@ -155,7 +160,10 @@ func main() {
 		fmt.Printf("grant_type: %s\n", grantType)
 		fmt.Printf("refresh_token: %s\n", refreshToken)
 		
-		tokenUrl := "https://gw.prd.api.enedis.fr/v1/oauth2/token"
+		// DEV API
+		tokenUrl := "https://gw.hml.api.enedis.fr/v1/oauth2/token"
+		// PROD API
+		// tokenUrl := "https://gw.prd.api.enedis.fr/v1/oauth2/token"
 		
 		data := url.Values{}
 		data.Set("client_id", clientId)
-- 
GitLab