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

API is broken at Feb 22 2017 3:20pm

Open tommywuhaojie opened this issue 9 years ago • 24 comments

Description: Unknown exception when logging in

Steps to reproduce: Use either Google or PTC method to login

Stacktrace W/System.err: Caused by: java.util.concurrent.ExecutionException: com.google.protobuf.InvalidProtocolBufferException: Contents of buffer are null W/System.err: at com.pokegoapi.main.RequestHandler$1.get(RequestHandler.java:120) W/System.err: at com.pokegoapi.main.RequestHandler$1.get(RequestHandler.java:97) W/System.err: at rx.internal.operators.OnSubscribeToObservableFuture$ToObservableFuture.call(OnSubscribeToObservableFuture.java:74) W/System.err: at rx.internal.operators.OnSubscribeToObservableFuture$ToObservableFuture.call(OnSubscribeToObservableFuture.java:43) W/System.err: at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) W/System.err: at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) W/System.err: at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) W/System.err: at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) W/System.err: at rx.Observable.subscribe(Observable.java:9957) W/System.err: at rx.Observable.subscribe(Observable.java:9924) W/System.err: at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:445) W/System.err: at rx.observables.BlockingObservable.first(BlockingObservable.java:168) W/System.err: at com.pokegoapi.util.AsyncHelper.toBlocking(AsyncHelper.java:45) W/System.err: ... 8 more W/System.err: Caused by: com.google.protobuf.InvalidProtocolBufferException: Contents of buffer are null W/System.err: at com.pokegoapi.main.ServerRequest.getData(ServerRequest.java:89) W/System.err: at com.pokegoapi.main.RequestHandler.run(RequestHandler.java:381) W/System.err: ... 1 more

Version: latest version

tommywuhaojie avatar Feb 22 '17 23:02 tommywuhaojie

Description: I have the same problem, just a few minutes ago, the API stopped working, I can no longer login with any account (PTC, Google, Token), I attach an image of the exception that I get in the console:

captura de pantalla 2017-02-22 a las 6 09 33 p m

Please, someone who can help us? Or tell us what is going on? Thanks in advance

Version: I'm using the last commited changes of the API. Thanks in advance!

vagprogrammer avatar Feb 23 '17 00:02 vagprogrammer

What API version are you using? When talking about API, that means the Pokemon Go server API, not the PokegoAPI-Java library.

s7092910 avatar Feb 23 '17 02:02 s7092910

How can I now what version of the Pokemon Go server API I am using?

vagprogrammer avatar Feb 23 '17 02:02 vagprogrammer

We are talking about PokegoAPI-Java library, namely this repo, with the latest commit, login fails no matter what

tommywuhaojie avatar Feb 23 '17 03:02 tommywuhaojie

@vagprogrammer if it requires the usage of a hashing key from Bossland, then that is depending on the end point used. If you are not using a hashing key, that means you are using the 0.45 api.

@tommywuhaojie The library uses the api, but there are multiple versions of the library and multiple versions of the api. You have made it clear that you are using the most up to date version of the library. But I'm asking what version of the api are you using. As right now you can choose which version of the api you want to use.

s7092910 avatar Feb 23 '17 04:02 s7092910

@s7092910 I think that they might be using 0.45 api. This is happening for me too, and I'm using the LegacyHashProvider.

fsQuiroz avatar Feb 23 '17 04:02 fsQuiroz

By the looks of that stack-trace, you've compiled from my fork's source, but haven't updated to the latest commit.

Gegy avatar Feb 23 '17 05:02 Gegy

@gegy1000 i'm using your fork up to 66bc865e03985beda481be92749f4e3acaff0e92, and i'm getting Failed to send request: SESSION_INVALIDATED as a response. Can't give logcat right now, maybe later. Is it just me or something changed in Niantic back-end?

pokesniperandroid avatar Feb 23 '17 06:02 pokesniperandroid

@gegy1000 @s7092910 Are you able to perform login? and how can I use the latest API instead of 0.45?

tommywuhaojie avatar Feb 23 '17 06:02 tommywuhaojie

@gegy1000 i'm using your fork up to 0e19aa3 and i'm getting Failed to send request: SESSION_INVALIDATED as a response like @pokesniperandroid. I attach an image of the exception that I get in the console: captura de pantalla 2017-02-23 a las 0 17 47

vagprogrammer avatar Feb 23 '17 06:02 vagprogrammer

@gegy1000 same here, getting SESSION_INVALIDATED and I use LegacyHashProvider for hasher image

tommywuhaojie avatar Feb 23 '17 06:02 tommywuhaojie

Same here

kilicool avatar Feb 23 '17 07:02 kilicool

Hi, i tried using both Legacy Hash(failed) and HashApi (success). I assuming the Legacy Hash 0.45 has been denied by Niantic Server.

btremote999 avatar Feb 23 '17 07:02 btremote999

@btremote999 may I know how to use HashApi?

tommywuhaojie avatar Feb 23 '17 07:02 tommywuhaojie

@tommywuhaojie , from the example https://github.com/Grover-c13/PokeGOAPI-Java/blob/Development/sample/src/main/java/com/pokegoapi/examples/ExampleConstants.java

  1. You need a Hash API key : buy from somewhere
  2. from the example call getHashProvider() to get the HashProvider
  3. pass the HashProvider to the api for login

btremote999 avatar Feb 23 '17 07:02 btremote999

Yes it seems that Niantic has caused 0.45 to reject login. So the Legacy Hash will not work anymore.

s7092910 avatar Feb 23 '17 07:02 s7092910

@btremote999 please explain more it's not clear at all. regards

kilicool avatar Feb 23 '17 08:02 kilicool

@btremote999 I got a hash key but when to try to login I get following error:

FATAL EXCEPTION: Async HTTP Thread
                                                                     Process: com.ivcalculatorpro, PID: 17939
                                                                     java.lang.NoSuchMethodError: No virtual method getHeaderFieldLong(Ljava/lang/String;J)J in class Ljava/net/HttpURLConnection; or its super classes (declaration of 'java.net.HttpURLConnection' appears in /system/framework/core-libart.jar)
                                                                         at com.pokegoapi.util.hash.pokehash.PokeHashKey.setProperties(PokeHashKey.java:57)
                                                                         at com.pokegoapi.util.hash.pokehash.PokeHashProvider.provide(PokeHashProvider.java:124)
                                                                         at com.pokegoapi.util.Signature.setSignature(Signature.java:79)
                                                                         at com.pokegoapi.main.RequestHandler.internalSendServerRequests(RequestHandler.java:199)
                                                                         at com.pokegoapi.main.RequestHandler.run(RequestHandler.java:376)
                                                                         at java.lang.Thread.run(Thread.java:833)

Any advice?

sino123 avatar Feb 23 '17 08:02 sino123

Why closed ??

kilicool avatar Feb 23 '17 08:02 kilicool

@sino123 try fork @gegy1000 's repo, check for PokeHashKey.java it has solution to solve it . method getHeaderFieldLong is not supported for all version, especially android.

this.ratePeriodEnd = this.getHeaderLong(connection, "X-RatePeriodEnd", this.ratePeriodEnd);

/**
 * Parses a long header
 * @param connection the connection to load the header from
 * @param name the header name
 * @param defaultValue the default value to use, if parsing fails
 * @return the parsed long
 */
private long getHeaderLong(HttpURLConnection connection, String name, long defaultValue) {
	try {
		return Long.parseLong(connection.getHeaderField(name));
	} catch (Exception e) {
		return defaultValue;
	}
}

btremote999 avatar Feb 23 '17 10:02 btremote999