NicklasWallgren / PokemonGoAPI-PHP

Pokemon Go API PHP library
BSD 2-Clause "Simplified" License
130 stars 51 forks source link

Fatal error: Uncaught Exception: Retrieved a unknown status code 100 #175

Open hwiVeloper opened 7 years ago

hwiVeloper commented 7 years ago

I have a question.

When I use getPokeBank() functionn, I get the error below.

Fatal error: Uncaught Exception: Retrieved a unknown status code 100 in /vendor/nicklasw/pkm-go-api/src/Handlers/RequestHandler.php:163

Stack trace:
  #0 /vendor/nicklasw/pkm-go-api/src/Services/Request/InventoryRequestService.php(27):
    NicklasW\PkmGoApi\Handlers\RequestHandler->handle(Object(NicklasW\PkmGoApi\Requests\GetInventoryRequest))
  #1 /vendor/nicklasw/pkm-go-api/src/Api/Player/Inventory.php(69):
    NicklasW\PkmGoApi\Services\Request\InventoryRequestService->getInventory()
  #2 /vendor/nicklasw/pkm-go-api/src/Api/Procedure.php(52):
    NicklasW\PkmGoApi\Api\Player\Inventory->update() #3 /test.php(61):

NicklasW\PkmGoApi\Api\Procedure->__call('getPokeBank', Array) #4 {main} thrown
  in /vendor/nicklasw/pkm-go-api/src/Handlers/RequestHandler.php on line 163

How can I solve this error?

my source code is..

// Authentication via Google user credentials

$manager = Factory::create($config);

$manager->addListener(function ($event, $value) {
  if ($event === Manager::EVENT_ACCESS_TOKEN) {
    $accessToken = $value;
  }
});

// Initialize the pokemon go application
$application = new ApplicationKernel($manager);

$pokemonGoApi = $application->getPokemonGoApi();

$journal = $pokemonGoApi->getJournal();

$inventory = $pokemonGoApi->getInventory();

$pokeBank = $inventory->getPokeBank(); // At this code, There is the error
NicklasWallgren commented 7 years ago

That particular error occurs when you send blank authinfo. Did you authenticate properly?

voxx commented 7 years ago

Hey @NicklasWallgren

I just started getting this same response on ALL checkChallenge and verifyChallenge requests. Nothing in my code has changed at all, but today it started throwing that error for every call.

screen shot 2017-02-14 at 1 55 22 pm screen shot 2017-02-14 at 1 52 12 pm

-voxx

voxx commented 7 years ago

Looks like pogodev is working on fixes for other API's. Niantic is now validating Platform_Requests on login.

ejwfwcsnwyamanbdubcwmb-s0qeqrbbesgbh51r19773fc-6xc4a86rdqeokpnyhicdktcg6rr1kmifjpg6vmfnud-lmymjctgguog1gxmcotadwivqlftbzb6j651vkpzb4yzr4bqbf4bahynmr-p0bwuunva 4wo47mhuzpbbawcp-phfggautjm

voxx commented 7 years ago

Additional notes from Leah.

almost all API's don't send it on request 1 without it, you don't get an endpoint

the very first request now requires unknown6 to be passed in

hwiVeloper commented 7 years ago

@NicklasWallgren I already wrote auth info. hmm... I'll try it again and ask again :) @voxx Does your source work now? I should try again..

NicklasWallgren commented 7 years ago

Thanks for the info @voxx. I'll have to take a look into the problem.

NicklasWallgren commented 7 years ago

@voxx Do you know if the signature has to be valid? This could be a problem since this library does not currently support "PlatformRequests" or any of the available hash providers.

gracefullight commented 7 years ago

Retrieved a unknown status code 100 I have the same problem. Nothing in my code has changed at all, but today it started throwing that error for every call

(certified by Google ID) $pokemonGoApi = $application->getPokemonGoApi();

// $this->logger->info('profile'); $profile = $pokemonGoApi->getProfile(); // <= Nothing here.

// $this->logger->info('get profile data'); $profileData = $profile->getData(); // <= Throw Error

voxx commented 7 years ago

@NicklasWallgren

I don't believe it actually has to be valid. Many of the API's are still using 0.45 api without hash server, so I'm assuming they aren't passing completely valid signature. (Not 100% positive, but fairly certain of this.)

I don't think we need to implement hash server support at this point, but we need to refactor login to include "PlatformRequests". I can probably help cherry pick out the relevant changes from pogoapi / rocketmap that were implemented a few weeks back that cover this aspect if you need me to.

-voxx

baskettcase commented 7 years ago

Yes Im having this problem today also.

baskettcase commented 7 years ago

Any news on this one?

sDenizhan commented 7 years ago

Is there a solution for this problem ?

Droeftoeter commented 7 years ago

100 means SESSION_INVALIDATED as far as I know. Basically it happens when the first request isn't also signed. The first request needs to be signed with the AuthInfo's token, the requests following that need to be signed with the AuthTicket.

baskettcase commented 7 years ago

Does this library have those capabilities @Droeftoeter, @NicklasWallgren ?

sDenizhan commented 7 years ago

@Droeftoeter it was working before last update. After that, i think somethings changed by Niantic. The AeonLucid, creator POGOProtos, updated his github repo after last update.

hwiVeloper commented 7 years ago

I heard that Niantic updated api. So, this repo has to be updated soon.

Droeftoeter commented 7 years ago

Yes, basically they're slowly phasing out support for 0.45

voxx commented 7 years ago

0.45 is officially dead. (uk25 value for 0.45 is no longer valid as of today)

However api calls utilizing uk25 value for >0.45 to 0.57.2 still work even with completely invalid hashing. (Paid hashing key is not required to get a valid response back.)

uk25 value is known for all versions including 0.57.2, so that's not a problem.

@Droeftoeter You're PR was on the right track, but just wasnt quite right yet. I messed around with it for a couple nights but wasn't able to fully wrap my head around the proper flow and structure in order to fix it.

I'm happy to lend a hand to help rebuild it if there's interest, but I don't think I'm going to be able to do it without someone elses help who knows a little more about the proper login flow and structure.

Most of the other API's have solved it, so the code is readily available to rip out and translate, it's just going to take some time and effort from a few of the php folks to make it happen.

I had to switch to the python api for handling captcha solving logic for my map feed, but I'd love to resurrect the php api if theres still anyone around that's able/willing to step in and help.

-voxx

Droeftoeter commented 7 years ago

@voxx I've solved it in my own API, but 0.57.2 itself requires a hashing server. If I have time I can try to redo the PR for this lib, and also add the 0.57.2 UK25 value.

baskettcase commented 7 years ago

I would love it if things were updated with this library. I have most of my code using it and it's decently simple to use. Hashing server would make me feel a whole lot better since I use this library with real accounts just to get my pokemon IV's and movesets.

xmillies commented 7 years ago

@Droeftoeter . Do you have time to redo the PR for this lib ?

xmillies commented 7 years ago

@Droeftoeter. Still no time ? I think we have no other choice than to add support hashing server .