PokeGOAPI-Java icon indicating copy to clipboard operation
PokeGOAPI-Java copied to clipboard

Google Login

Open dtunctuncer opened this issue 10 years ago • 5 comments

I haven't manage to sign in with google account could someone send some example code

dtunctuncer avatar Jul 23 '16 10:07 dtunctuncer

OkHttpClient http = new OkHttpClient();
RequestEnvelopeOuterClass.RequestEnvelope.AuthInfo auth = auth = new GoogleLogin(http).login("", ""); 
PokemonGo go = new PokemonGo(auth, http);

first line in console will be something like this

D/GoogleLogin: Get user to go to:https://www.google.com/device and enter code:XXXX-XXXX

Just open the link and enter the code for the account you want to use

LEGENDFF avatar Jul 23 '16 10:07 LEGENDFF

is there any way to do this programatically ?

dtunctuncer avatar Jul 23 '16 14:07 dtunctuncer

U can open a webpage/webview with the link and have the code copied to the clipboard.

rajulbhatnagar avatar Jul 23 '16 21:07 rajulbhatnagar

i can use google login sign button ?

Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient); startActivityForResult(signInIntent, RC_SIGN_IN);

using id token ? i tried it but give login failed.

john086 avatar Jul 24 '16 12:07 john086

How

can I use Android's native Google sign in with this libary?

You can't. The Google Indentity Platform uses the SHA1 fingerprint and package name to authenticate the caller of all sign in requests. This means that Niantic would need to add your app's SHA1 fingerprint and package name to their Google API Console. If you ever requested a Google Maps API key, you went through the same process. An alternative would be using a WebView to access the web based OAuth flow. This will work with the client ID and secret provided by this library.

You will have to stick to using a web oauth flow and passing the access token, or using the google login and getting the url and code with listeners.

Grover-c13 avatar Jul 24 '16 16:07 Grover-c13