Skip to content

pogo.GetProfile throws exception after successful login #266

@hjw3001

Description

@hjw3001

`
'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)
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions