Update Client.cs

Baha Striker [2016-07-28 22:53:10]
Update Client.cs
Filename
PokemonGo/RocketAPI/Client.cs
diff --git a/PokemonGo/RocketAPI/Client.cs b/PokemonGo/RocketAPI/Client.cs
index c3d5094..7e247ea 100644
--- a/PokemonGo/RocketAPI/Client.cs
+++ b/PokemonGo/RocketAPI/Client.cs
@@ -20,6 +20,7 @@ using System.Threading;
 using PokemonGo.RocketAPI.Exceptions;
 using System.Text;
 using System.IO;
+using DankMemes.GPSOAuthSharp;

 #endregion

@@ -85,27 +86,24 @@ namespace PokemonGo.RocketAPI
                         catchPokemonRequest);
         }

-        public async Task DoGoogleLogin()
+        public async Task DoGoogleLogin(string email, string password)
         {
             _authType = AuthType.Google;
-            GoogleLogin.TokenResponseModel tokenResponse = null;
-
-            if (string.IsNullOrEmpty(_settings.GoogleRefreshToken) && string.IsNullOrEmpty(AccessToken))
-            {
-                var deviceCode = await GoogleLogin.GetDeviceCode();
-                tokenResponse = await GoogleLogin.GetAccessToken(deviceCode);
-                _accessToken = tokenResponse.id_token;
-                ColoredConsoleWrite(ConsoleColor.White, $"Put RefreshToken in settings for direct login: {tokenResponse.refresh_token}");
-                _settings.GoogleRefreshToken = tokenResponse.refresh_token;
-                AccessToken = tokenResponse.refresh_token;
-            }
-            else
+            GPSOAuthClient _GPSOclient = new GPSOAuthClient(email, password);
+            Dictionary<string, string> _GPSOresponse = _GPSOclient.PerformMasterLogin();
+            /* string json = JsonConvert.SerializeObject(_GPSOresponse, Formatting.Indented);
+               Console.WriteLine(json); */
+            if (_GPSOresponse.ContainsKey("Token"))
             {
-                if (!string.IsNullOrEmpty(_settings.GoogleRefreshToken))
-                    tokenResponse = await GoogleLogin.GetAccessToken(_settings.GoogleRefreshToken);
-                else
-                    tokenResponse = await GoogleLogin.GetAccessToken(AccessToken);
-                _accessToken = tokenResponse.id_token;
+                string token = _GPSOresponse["Token"];
+                Dictionary<string, string> oauthResponse = _GPSOclient.PerformOAuth(
+                token,
+"audience:server:client_id:848232511240-7so421jotr2609rmqakceuu1luuq0ptb.apps.googleusercontent.com",
+"com.nianticlabs.pokemongo",
+"321187995bc7cdc2b5fc91b11a96e2baa8602c62");
+                /* string oauthJson = JsonConvert.SerializeObject(oauthResponse, Formatting.Indented);
+                  Console.WriteLine(oauthJson); */
+                _accessToken = oauthResponse["Auth"];
             }
         }
You may download the files in Public Git.