RocketBot icon indicating copy to clipboard operation
RocketBot copied to clipboard

[Tip]New Google Auth Fix

Open Fliperworld opened this issue 10 years ago • 108 comments

Since GetDeviceCode(), returns status 401 and a personal ClientId and ClientSecret throw AccessTokenExpiredException(), i found this 2 usefull links: https://github.com/Mila432/Pokemon_Go_API/blob/master/login.py and https://github.com/vemacs/GPSOAuthSharp Combining those 2 we can login with a google account:

  • Download , change GPSOAuthSharp project to .Net 4.5 , and compile.
  • Add a reference to GPSOAuthSharp.dll in your Pokemon-Go-Rocket-API project
  • In Pokemon-Go-Rocket-API/PokemonGo/RocketAPI/Client.cs , add
using DankMemes.GPSOAuthSharp; 

comment lines 91 to 109:

  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
            {
                if (!string.IsNullOrEmpty(_settings.GoogleRefreshToken))
                    tokenResponse = await GoogleLogin.GetAccessToken(_settings.GoogleRefreshToken);
                else
                    tokenResponse = await GoogleLogin.GetAccessToken(AccessToken);
                _accessToken = tokenResponse.id_token;
}

and add those code on line 110:

                 string email = "YOUR GMAIL";
                 string password = "YOUR PASSWORD";
                   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"))
                         {
                              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"];
                          }

@sicheater compiled GPSOAuthSharp.dll

Strategic Breakpoints are at "if (_GPSOresponse.ContainsKey("Token"))" and " _accessToken = oauthResponse["Auth"];"

Important : this code is just a idea/adaptation of a code that i'm working on , try not store credentials in source code....A best approach is setting/getting those values from ISettings.cs and other related files

DoGoogleLogin.txt

Edit: you can add "GPSOAuthSharp.cs" directly to your Pokemon-Go-Rocket-API project

Fliperworld avatar Jul 28 '16 13:07 Fliperworld

Could you break that down to a third grade level haha. Programming is not my thing!

Machiavellian0 avatar Jul 28 '16 14:07 Machiavellian0

Could you do this for us in a new API for download ?

delsin94 avatar Jul 28 '16 14:07 delsin94

i get this

The primary reference "GPSOAuthSharp" could not be resolved because it was built against the ".NETFramework,Version=v4.5.2" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5". PokemonGo.RocketAPI

Tanuki33 avatar Jul 28 '16 14:07 Tanuki33

No problems here.

Grunkhead avatar Jul 28 '16 14:07 Grunkhead

Replacing gave me a bunch of errors?

ghost avatar Jul 28 '16 14:07 ghost

thanks! it work! just change target framework on GPSOAuthSharp to v4.5.

Tanuki33 avatar Jul 28 '16 14:07 Tanuki33

Hello! Can u give me source with done fix ? I cant replace, error's...

EskimoLV avatar Jul 28 '16 14:07 EskimoLV

on PokemonGo.RocketAPI add this to references GPSOAuthSharp.zip (dll file) then open Client.cs next just follow the step on top. or try replace all with this Client.cs.txt change email and pass before ctrl+f5. Good luck!

Tanuki33 avatar Jul 28 '16 14:07 Tanuki33

@sicheater : just Change the Target Framework GPSOAuthSharp project to .Net Framework 4.5 First Post Updated. My old post was based on FeroxRev version....

Fliperworld avatar Jul 28 '16 14:07 Fliperworld

errors, cant fix myself

EskimoLV avatar Jul 28 '16 14:07 EskimoLV

worked like a charm, though not sure if I feel realy comfy with this code =)

rvzundert avatar Jul 28 '16 15:07 rvzundert

Thanks, It worked! Also you explained It well.

sdtcnylcn avatar Jul 28 '16 15:07 sdtcnylcn

@sdtcnylcn , this code is only to get a valid google access Token, pokestops and pokemon catching can be a temporary softban if you moved to far.

Fliperworld avatar Jul 28 '16 15:07 Fliperworld

Okay, It started working to me also, for the second time. I had to discard every change I have done so far, reset every setting in Window project App.config, and now it is working! (Doing pokestops, catching pokemons, etc.) @EskimoLV Did you replace the

string email = "YOUR GMAIL";
string password = "YOUR PASSWORD";

In the new code?

dexter323i avatar Jul 28 '16 15:07 dexter323i

@sdtcnylcn Yeah, you're probably softbanned.

There is this program called QuickSpin which uses the google auth method and it gets you unbanned within a minute quite easily, but as it uses the auth method which is messed up atm it doesn't work.. If anyone knows how to skip the auth so you can replace it with your token key it would be much appreciated. Links: http://www.ownedcore.com/forums/pokemon-go/pokemon-go-hacks-cheats/565264-quickspin-pokemongo-softban-unbanner-quickly-unbans-your-softbanned-account.html

shaysht avatar Jul 28 '16 15:07 shaysht

googlelogin.cs still error @Fliperworld

brad0pitt avatar Jul 28 '16 15:07 brad0pitt

Thanks it's working 💃

renandus41 avatar Jul 28 '16 15:07 renandus41

hello guys, when i need to enter token its crushing and forcing me to close the program any tips for this ?

capture

huserkmen avatar Jul 28 '16 15:07 huserkmen

@huserkmen Merhaba, Yukarida ilk paylasimda yazan seyleri yapmalisin.Ondan sonra direk giris saglayabilirsin.

sdtcnylcn avatar Jul 28 '16 15:07 sdtcnylcn

this wont work if google account has 2-Step Verification

trungking avatar Jul 28 '16 15:07 trungking