From 9a130848417e9b6c1469d4d7d268a7932a44390a Mon Sep 17 00:00:00 2001
From: Edward Romero <edward@greenlight.me>
Date: Tue, 23 Jun 2020 20:43:49 -0400
Subject: [PATCH] Parse body to get substring

---
 src/authutil.ts | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/authutil.ts b/src/authutil.ts
index a4df3d80..50065068 100644
--- a/src/authutil.ts
+++ b/src/authutil.ts
@@ -36,11 +36,15 @@ async function getAuthToken(
   });
   let response: hc.HttpClientResponse = await httpClient.get(authUrl);
   console.log(response);
+  /**
+   * constains string _auth = ***OmV5***\nalways-auth = true
+   * we will parse it by using indexes
+   */
   let body: string = await response.readBody();
-  core.info(body);
-  let data: any = JSON.parse(body);
-  core.info(JSON.stringify(data));
-  return '';
+  const startIndex = body.indexOf('_auth') + 8;
+  const endIndex = body.indexOf('\n');
+  const authToken = body.substring(startIndex, endIndex);
+  return authToken;
 }
 
 async function writeRegistryToFile(