brianzhouzc / RocketBot

An automated Pokémon Go Bot
GNU General Public License v3.0
564 stars 315 forks source link

[Tip]New Google Auth Fix #440

Closed Fliperworld closed 8 years ago

Fliperworld commented 8 years ago

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:

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

Machiavellian0 commented 8 years ago

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

delsin94 commented 8 years ago

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

Tanuki33 commented 8 years ago

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

Grunkhead commented 8 years ago

No problems here.

ghost commented 8 years ago

Replacing gave me a bunch of errors?

Tanuki33 commented 8 years ago

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

EskimoLV commented 8 years ago

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

Tanuki33 commented 8 years ago

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!

Fliperworld commented 8 years ago

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

crysinister commented 8 years ago

Pull up that sir

EskimoLV commented 8 years ago

errors, cant fix myself

rvzundert commented 8 years ago

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

sdtcnylcn commented 8 years ago

Thanks, It worked! Also you explained It well.

Fliperworld commented 8 years ago

@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.

dexter323i commented 8 years ago

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?

shaysht commented 8 years ago

@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

brad0pitt commented 8 years ago

googlelogin.cs still error @Fliperworld

renandus41 commented 8 years ago

Thanks it's working 💃

huserkmen commented 8 years ago

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

capture

sdtcnylcn commented 8 years ago

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

trungking commented 8 years ago

this wont work if google account has 2-Step Verification

crysinister commented 8 years ago

mee to crash here -,-

huserkmen commented 8 years ago

@sdtcnylcn yukarıdaki herşey sorunsuz çalışıyor programı başlatınca chrome sayfasına geçiyor ve direk bu hatayı alıyorum sonrası malum giriş sağlanmıyor.

sdtcnylcn commented 8 years ago

@huserkmen yanlis yapmissin.Duzgun yaptiginda google sayfasina gecirmiyor direk console acilip giris sagliyosun.

EskimoLV commented 8 years ago

@dexter323i, yes... and always errors... can u give me please done source code and i will edit only email,password. i dont know why, but i cant fix, trying 30000 over times, im so low on programming :DD

huserkmen commented 8 years ago

@sdtcnylcn autsharp indirdim frameworkü 4.5 yaptm api projecte dll referansını ekledim clients dosyasını adamın yolladığını yapıştırdım email pass girdim daha farklı birşey yapmam gerekiyor mu

sdtcnylcn commented 8 years ago

Bak simdi o dll dosyasinin reference yerine koydun degil mi?En ustteki yere.Bunu yaptiysan sonra clients e giriyosun ve ilk adamin dedigi yerleri commentliyosun.Sonra commentledigin yere yukarda verdigi seyi kopyala yapistir yapiyosun.Sonrasi dedigin gibi email pass ve programi calistiriyosun @huserkmen

Kagelol commented 8 years ago

Works.

Kijryz commented 8 years ago

I Edited all Step but it keeps crashing for me...

Am i doing it right?

  1. Download the other project and change the Version to 4.5
  2. generate the DLL for the project
  3. adding the reference in the Project
  4. inject the new Code
  5. insert email and password ofc So why is it still trying to copy the code and instant open the Google/device link... I´d appreciate help :P
sdtcnylcn commented 8 years ago

Did you comment out the old code that you will change with the code in the first post? @Kijryz

huserkmen commented 8 years ago

1 2

emaili sildim ss için stepleri kontrol edebilir misin sslerini attım, teşekkürler @sdtcnylcn

Kagelol commented 8 years ago

What i did was Download the other project, add it to the existing solution, change to .net 4.5 reference it by referencing the project (Reference this in the PokemonGo.RocketAPI project) open client.cs in that same project, reference it at top "using DankMemes.GPSOAuthSharp; " Removed old code, placed new code, look carefull at the brackets, that you dont miss one or have one extra. and run

Transferred Arcanine with 2318 CP (Highest is 2468) :( forgot to make some changes myself though

sdtcnylcn commented 8 years ago

GoogleLogin ile baslayan satirdan asagidaki else yazisi olan satirdan 3 satir asagidaki "}" isareti olan satira kadar sil.Sonra sildigin yere yukardaki kodu yapistir. @huserkmen

huserkmen commented 8 years ago

@sdtcnylcn bana bi ss atabilirmisin çalışan halini emailini silmeyi unutma :D

gerrygendut commented 8 years ago

@huserkmen did u make it? if yes help, please help mine crash like yours too

Kijryz commented 8 years ago

@sdtcnylcn acutally yes, the bot is still crashing ...

huserkmen commented 8 years ago

@gerrygendut not yet i will let u know it should bypass token part so we are doing it wrong most likely.

gerrygendut commented 8 years ago

@huserkmen mine crash during google.com/devices opened, and when i tried to Ctrl+v code, theres nothing

huserkmen commented 8 years ago

@gerrygendut point is with this method u shouldnt see token part at all. did u write ur email and password inside ?

gerrygendut commented 8 years ago

@huserkmen yeah i did, yet it still ask for code, means something is wrong then lol

huserkmen commented 8 years ago

Can someone tell me is everyting ok here ? ps: i deleted email and pass for ss 444

Fliperworld commented 8 years ago

@huserkmen if you are using editing RocketAPI/Client.cs , your DoGoogleLogin() , can be just : DoGoogleLogin.txt

on your screenshot my new code won't will be called if your _settings.GoogleRefreshToken or AccessToken aren't null/empty .

gerrygendut commented 8 years ago

@huserkmen @Fliperworld it worked thanks

huserkmen commented 8 years ago

@Fliperworld thank u man it worked ! i got the issue now cheers !

Metin2Force commented 8 years ago

19:21:42 ] Login Type: Google [19:21:42 ] Program Will Retart Every Hour! [19:21:42 ] Now opening www.Google.com/device and copying the 8 digit code to your clipboard [19:21:42 ] Argument Null Refference - Restarting [19:21:42 ] Login Type: Google [19:21:42 ] Program Will Retart Every Hour!

Problem :(

crysinister commented 8 years ago

@Metin2Force server maintance ;)

Metin2Force commented 8 years ago

KAfayı yiyecem ya:S

FreeHitss commented 8 years ago

i have couple errors what line should i put? " string email = "YOUR GMAIL";" and so on

Fliperworld commented 8 years ago

@FreeHitss DoGoogleLogin.txt

suhadi95 commented 8 years ago

server maintance? i am stuck here.. maintance