Pokemon-GO-node-api
Pokemon-GO-node-api copied to clipboard
Auto logout after some time and/or session expire?
Instead of calling a.init() to login, i'm doing the following:
a.playerInfo.provider = provider;
a.playerInfo.accessToken = accessToken;
a.playerInfo.apiEndpoint = apiEndpoint;
where provider, accessToken, and apiEndpoint are variables saved in a filesystem. And then I use a.setLocation to set location.
This helps restarting node without having to keep logging in (might trigger a soft ban). This works fine for a few hours, and then I start to get 'No result' error from Pokemon GO server, regardless of the api call. I'm guessing the session expired or something? Any tips regarding this?
I solved this by checking for "No result" inside my heartbeat function and logging back in.
if(err) {
console.log(err);
if(err === "No result") {
clearInterval(start);
init();
}
return;
}