From 0ee7749d76291a69ac5f0ea12029f9373fabd911 Mon Sep 17 00:00:00 2001
From: "ext.sopra.yvallet@grandlyon.com" <ext.sopra.yvallet@grandlyon.com>
Date: Tue, 20 Oct 2020 11:54:37 +0200
Subject: [PATCH] fix error from body parsing

---
 main.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/main.go b/main.go
index 85dac31..8cce8c9 100644
--- a/main.go
+++ b/main.go
@@ -430,7 +430,7 @@ func main() {
 				http.Error(w, http.StatusText(500), 500)
 			}
 			clientSecretStartIndex += len(clientSecretKey)
-			clientSecret = pageContent[clientSecretStartIndex : clientSecretStartIndex+clientSecretStartIndex]
+			clientSecret = pageContent[clientSecretStartIndex : clientSecretStartIndex+clientSecretLength]
 			//Check for code
 			codeKey := "code="
 			codeLength := 27
@@ -443,7 +443,6 @@ func main() {
 			}
 			//Check for grant_type
 			grandTypeKey := "grant_type="
-			grandTypeLength := 27
 			grandTypeStartIndex := strings.Index(pageContent, grandTypeKey)
 			if grandTypeStartIndex == -1 {
 				log.Error("No grant_type found")
-- 
GitLab