forked from FeroxRev/Pokemon-Go-Rocket-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
132 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace PokemonGo.RocketAPI.Exceptions | ||
{ | ||
public class GoogleException : Exception | ||
{ | ||
public GoogleException(string message) : base(message) | ||
{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace PokemonGo.RocketAPI.Exceptions | ||
{ | ||
public class GoogleOfflineException : Exception | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using DankMemes.GPSOAuthSharp; | ||
using Newtonsoft.Json; | ||
using PokemonGo.RocketAPI.Exceptions; | ||
|
||
namespace PokemonGo.RocketAPI.Login | ||
{ | ||
public static class GoogleLoginGPSOAuth | ||
{ | ||
public static string DoLogin(string username, string password) | ||
{ | ||
GPSOAuthClient client = new GPSOAuthClient(username, password); | ||
Dictionary<string, string> response = client.PerformMasterLogin(); | ||
|
||
if(response.ContainsKey("Error")) | ||
throw new GoogleException(response["Error"]); | ||
|
||
//Todo: captcha/2fa implementation | ||
|
||
if(!response.ContainsKey("Auth")) | ||
throw new GoogleOfflineException(); | ||
|
||
Dictionary<string, string> oauthResponse = client.PerformOAuth( response["Token"], | ||
"audience:server:client_id:848232511240-7so421jotr2609rmqakceuu1luuq0ptb.apps.googleusercontent.com", | ||
"com.nianticlabs.pokemongo", | ||
"321187995bc7cdc2b5fc91b11a96e2baa8602c62"); | ||
|
||
if(!oauthResponse.ContainsKey("Auth")) | ||
throw new GoogleOfflineException(); | ||
|
||
return oauthResponse["Auth"]; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters