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

Every login attempt fails

Open pvanassen opened this issue 10 years ago • 6 comments

Every login attempt fails with the following exception: com.pokegoapi.exceptions.LoginFailedException: Refreshing token failed Error in API Url

E/Main: Failed to login or server issue: 
com.pokegoapi.exceptions.LoginFailedException: Refreshing token failed Error  in API Url 
    at com.pokegoapi.main.RequestHandler.sendServerRequests(RequestHandler.java:141)
    at com.pokegoapi.api.player.PlayerProfile.updateProfile(PlayerProfile.java:79)
    at com.pokegoapi.api.player.PlayerProfile.<init>(PlayerProfile.java:67)
    at com.pokegoapi.api.PokemonGo.<init>(PokemonGo.java:66)
    at nl.pvanassen.pokemon.Main.main(Main.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

This is fixed by reverting commits: ccf016dd2c5da122763b14a2a06b500e5c08e890 7ccf228edcc0615cdf441b027a7925bc3db309da

pvanassen avatar Jul 24 '16 10:07 pvanassen

For some reason the login-script does not fetch an refresh token. therefor it stays null, whenever the current token expires and the refresh token is null you get this error. Edit: Forgot to mention that the error should occur for everybody.

SonnyX avatar Jul 24 '16 10:07 SonnyX

You should get a refreshToken if u call GoogleLogin.login() Then next time you can call GoogleLogin.login("tokenid if u have 1 or empty string","refreshtoken that you should have persisted")

Only the call to GoogleLogin.login() sets the refresh token. How are u guys using the API.

rajulbhatnagar avatar Jul 24 '16 14:07 rajulbhatnagar

This is the login flow we use for google auth https://developers.google.com/identity/protocols/OAuth2ForDevices#overview

rajulbhatnagar avatar Jul 24 '16 14:07 rajulbhatnagar

The com.pokegoapi.auth.GoogleLogin#login(java.lang.String, java.lang.String) method used to accept username + password. It has been rewritten to accept token + refresh token. Now there's no way to initially login with username + password.

pvanassen avatar Jul 25 '16 09:07 pvanassen

Username and Password was never used for Google Login by the api. As in the values passed were ignored.

rajulbhatnagar avatar Jul 25 '16 09:07 rajulbhatnagar

Nope indeed. Just the login() call should be enough.

pvanassen avatar Jul 25 '16 09:07 pvanassen