Pokemon-GO-node-api icon indicating copy to clipboard operation
Pokemon-GO-node-api copied to clipboard

pogo.GetProfile throws exception after successful login

Open hjw3001 opened this issue 7 years ago • 2 comments

` 'use strict';

var PokemonGO = require('./poke.io.js'); var pogo = new PokemonGO.Pokeio();

var location = { type: 'coords', coords: { latitude: -34.60537813731424, longitude: -58.366670608520508 } };

var username = 'user'; var password = 'password'; var provider = 'ptc';

pogo.init(username, password, location, provider, function(err) { if (err) throw err;

console.log('Current location: ' + pogo.playerInfo.locationName);
console.log('lat/long/alt: : ' + pogo.playerInfo.latitude + ' ' + pogo.playerInfo.longitude + ' ' + pogo.playerInfo.altitude);

pogo.GetProfile(function(err, profile) {
    if (err) throw err;

    console.log('Username: ' + profile.username);

    var currency = {};
    for (var i in profile.currency){
        var type = profile.currency[i].type;
        var amount = profile.currency[i].amount;
        if (!amount){
            amount = 0;
        }
        currency[type] = amount;
    }
    console.log('Stardust: ' + currency['STARDUST']);
});

pogo.GetInventory(function(err, inventory){
    if (err) throw err;
    var cleanedInventory = { player_stats: null, eggs : [], pokemon: [], items: [] };
    console.log(inventory);
    callback(cleanedInventory);
});

});`

It looks like my user is successful in logging in, an exception keeps occuring on:

Pokeio.GetProfile

I'm using a new PTC account, one that so far I've just used for PokeSensor. This user hasn't caught any Pokemon. Is there some more steps I need to do with that user for GetProfile to work?

`[i] Logging with user: ... [i] Session token: ... [i] Received PTC access token! [i] Received API Endpoint: https://null/rpc Current location: .... lat/long/alt: : .... /Users/henrywagner/Developer/node/Pokemon-GO-node-api/demo.js:25 if (err) throw err; ^

Error: Error at Request._callback (/Users/henrywagner/Developer/node/Pokemon-GO-node-api/poke.io.js:266:27) at self.callback (/Users/henrywagner/Developer/node/Pokemon-GO-node-api/node_modules/request/request.js:188:22) at emitOne (events.js:96:13) at Request.emit (events.js:188:7) at Request.onRequestError (/Users/henrywagner/Developer/node/Pokemon-GO-node-api/node_modules/request/request.js:884:8) at emitOne (events.js:96:13) at ClientRequest.emit (events.js:188:7) at TLSSocket.socketErrorListener (_http_client.js:310:9) at emitOne (events.js:96:13) at TLSSocket.emit (events.js:188:7) `

hjw3001 avatar Mar 14 '17 05:03 hjw3001