diff --git a/main.go b/main.go
index eb623b7f1d864273ff14bbfba88795e52f378e6c..e6ea6fb49b447249604897ec9035c902863523a5 100644
--- a/main.go
+++ b/main.go
@@ -19,7 +19,8 @@ func main() {
 	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
 		query := r.URL.Query()
 		fmt.Println(query)
-		host := strings.Split(query.Get("state"), "-")[1]
+		// host := strings.Split(query.Get("state"), "-")[1]
+		host := query.Get("state")
 		fmt.Println(host)
 		state := query.Get("state")
 		fmt.Println(state)
@@ -27,7 +28,7 @@ func main() {
 		fmt.Println(usagePointId)
 		code := query.Get("code")
 		fmt.Println(code)
-		redir := "https://" + host + "?code=" + code + "&state="+ state +"&usage_point_id=" + usagePointId
+		redir := "https://" + host + "/accounts/enedisoauth/redirect?code=" + code + "&state="+ state +"&usage_point_id=" + usagePointId
 		fmt.Println(redir)
 		http.Redirect(w, r, redir, 302)
 	})