NicklasWallgren / PokemonGoAPI-PHP

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

Can't authenticate using Google #89

Closed WisdomSky closed 8 years ago

WisdomSky commented 8 years ago

When I authenticate with my gmail account, it throws an exception.

I'm using the authentication-managers branch

code:

        $config = new Config();
        $config->setProvider(Factory::PROVIDER_GOOGLE);
        $config->setUser('i.wisdomsky@gmail.com');
        $config->setPassword('***********');

        // Create the authentication manager
        $manager = Factory::create($config);

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

        // Retrieve the pokemon go api instance
        $pokemonGoApi = $application->getPokemonGoApi();

        // Retrieve the profile
        $profile = $pokemonGoApi->getProfile();

        // Retrieve the profile data
        $profileData = $profile->getProfileData();

        echo sprintf('The profile data: %s', print_r($profileData, true));

Fatal error: Uncaught NicklasW\PkmGoApi\Authentication\Exceptions\AuthenticationException: Invalid user credentials. Response: 'Error=NeedsBrowser Url=https://accounts.google.com/signin/continue?sarp=1&scc=1&continue=https%3A%2F%2Faccounts.google.com%2Fo%2Fandroid%2Fauth%3Fhl%3Den_us%26xoauth_display_name%3DAndroid%2BLogin%2BService%26source%3DAndroid%2BLogin&plt=AKgnsbtVyK16sb0Z95B97DMzoi3BMQoQfA3_U3B7apt7P7Ue218IMbgvITsjLZzvYF0S9O20GizZo-ge-rqj999FlulByHooy__jaDWrlVi3MYeEZ1lf-hnwP-f624ZRMTkR96M-Pcau6tIo-VSvwfr_2j41ttFQ2BFID5-4ViwCwn-JFYc7nkAzznsJBsZ_qv2x0Kre6lx3mFShfwwykjFgWTNRJFHLH5peHYvWFuyTfEYjInFk094 ErrorDetail=To access your account, you must sign in on the web. Touch Next to start browser sign-in.' in /var/www/html/scrup/public/pogo/src/Authentication/Managers/Google/AuthenticationCredentials/Parsers/TokenParser.php:43 Stack trace: #0 /var/www/html/scrup/public/pogo/src/Authentication/Managers/Google/AuthenticationCredentials/Clients/AuthenticationClient.php(79): NicklasW\PkmGoApi\Authentication\Managers\Google\A in /var/www/html/scrup/public/pogo/src/Authentication/Managers/Google/AuthenticationCredentials/Parsers/TokenParser.php on line 43

PS: I already tried it with the master branch, still the same.

WisdomSky commented 8 years ago

fixed by running https://accounts.google.com/b/0/DisplayUnlockCaptcha