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

Logging In PokemonGo Returning Null

Open mackenzieg opened this issue 10 years ago • 1 comments

Description: When I attempt to login PokemonGo returns null.

    public PokemonGoBot() {
    OkHttpClient client = new OkHttpClient();
    PokemonGo pokemonGo = null;
    if (Config.isGoogle())
        googleAuthentication(client);

    pokemonGoBot = new BotProfile(pokemonGo,
            client, Config.getLatitude(), Config.getLongitude());
    BotManager botManager = new BotManager(pokemonGoBot);
    botManager.start();
}

public PokemonGo googleAuthentication(OkHttpClient client) {

    PokemonGo pokemonGo = null;
    GoogleAutoCredentialProvider googleCredentialProvider = null;
    try {

        googleCredentialProvider = new GoogleAutoCredentialProvider(client, Config.getUsername(), Config.getPassword());
        pokemonGo = new PokemonGo(googleCredentialProvider, client);

    } catch (LoginFailedException e) {
        e.printStackTrace();
    } catch (RemoteServerException e) {
        e.printStackTrace();
    }

    String uuid = UUID.randomUUID().toString();
    Random random = new Random(uuid.hashCode());



    DeviceInfo deviceInfo = new DeviceInfo();
    deviceInfo.setDeviceId(uuid);
    deviceInfo.setDeviceBrand("Apple");

    String[] device = devices[random.nextInt(devices.length)];
    deviceInfo.setDeviceModel(device[1]);
    deviceInfo.setDeviceModelBoot(device[0]);
    deviceInfo.setHardwareManufacturer("Apple");
    deviceInfo.setHardwareModel(device[2]);
    deviceInfo.setFirmwareBrand("iPhone OS");
    deviceInfo.setFirmwareType(osVersions[random.nextInt(osVersions.length)]);
    pokemonGo.setDeviceInfo(deviceInfo);`

I have looked into setting the SensorInfo as that may be a problem leading me to this:

       try {
        SignatureOuterClass.Signature.SensorInfo sensorInfo = SignatureOuterClass.Signature.SensorInfo.newBuilder().build();

        Field field = sensorInfo.getClass().getField("angleNormalizedZ_");
        field.setAccessible(true);
        field.setInt(sensorInfo, 0);
    } catch (Exception e) {
        e.printStackTrace();
    }

Please tell me how about I go logging in?

Version: 0.4.0

mackenzieg avatar Aug 10 '16 23:08 mackenzieg

This is not really the place for debugging your own code. You have a debugger for that. The API works just fine.

You aren't assigning the PokemonGo client variable outside of your googleAuthentication() method.

broach avatar Aug 11 '16 00:08 broach