seregazhuk / php-pinterest-bot

This PHP library will help you to work with your Pinterest account without using any API account credentials.
MIT License
416 stars 129 forks source link

Login method not working #442

Closed derkleinemukk closed 5 years ago

derkleinemukk commented 5 years ago

Same as reported by someone else.

Login method doesn't seem to work, error message when calling the isBanned method. Fatal error: Uncaught seregazhuk\PinterestBot\Exceptions\AuthRequired: Error calling seregazhuk\PinterestBot\Api\Providers\User::isBanned method. You must log in before

Tried: var_dump($bot->getLastError()); output NULL

Tried the credentials in the browser, working fine there. Account not blocked etc.

jliartem5 commented 5 years ago

same here, account seem not blocked, still getting traffic but PHP bot didn't work, maybe an new update from Pinterest?

asperduti commented 5 years ago

Same problem here. I can log in the browser with the same credentials used in the bot.

seregazhuk commented 5 years ago

Yes, looks like Pinterest has changed its API 😞

MaurieF commented 5 years ago

Sergey, Do you think the login issue can be resolved? Similar to other users, my sign in credentials work in the browser.

seregazhuk commented 5 years ago

Do you think the login issue can be resolved?

Not now. Currently, I don't have free time to fix it 😞

derkleinemukk commented 5 years ago

Would be happy to help with resolving it, do you already have an idea of what needs to be changed where? Pinterest docs only talk about oAuth with a registered app, so that's not really helpful.

The URL you're using to create the user session https://www.pinterest.co.uk/resource/UserSessionResource/create/ does work in the browser (based on cookies I also get my user info back in the browser, so the endpoint itself is working). Didn't get much further with my digging, but maybe you did?!

tuxado commented 5 years ago

any solution ?

Nurichief commented 5 years ago

any solution ? help!

seregazhuk commented 5 years ago

Didn't get much further with my digging, but maybe you did?!

Yes, I did. And they have changed the whole authentication system. It is not a matter of one request. So feel free to provide PR to fix it.

MaurieF commented 5 years ago

I am happy to help....., just need a little bit of guidance to get started... Is there anywhere I can see the authentication system? In my use of the bot, I really only require logging in to get pin activity. All other parts of the bot, as far as I can see, work very well.

jliartem5 commented 5 years ago

Didn't get much further with my digging, but maybe you did?!

Yes, I did. And they have changed the whole authentication system. It is not a matter of one request. So feel free to provide PR to fix it.

when I try to use Postman for post request, Pinterest returns always the page "need to activate Javascript".
But in the Cookie we can find "csrftoken"

jliartem5 commented 5 years ago

I am happy to help....., just need a little bit of guidance to get started... Is there anywhere I can see the authentication system? In my use of the bot, I really only require logging in to get pin activity. All other parts of the bot, as far as I can see, work very well.

use chrome extension like Web Sniffer to trace login process and find the variables and the way that use pintreset to login

for debugging the request of this package edit ( C:...\vendor\seregazhuk\pinterest-bot\src\Api\CurlHttpClient.php ) and add before the return line of [function init($url, $postString, $headers)] this lines

curl_setopt($this->curl, CURLOPT_VERBOSE, true); $verbose = fopen('c:\temp.txt', 'a+'); curl_setopt($this->curl, CURLOPT_STDERR, $verbose);

for @seregazhuk

  1. for registration of new account it work and the response of bot->register() give auth=1 but i suggest to save the cookies response _pinterest_sess and csrftoken to autologin (to prevent pinterest ban) at Auth.php `` /**

    • @param Registration $registrationForm
    • @return bool|mixed */ protected function makeRegisterCall(Registration $registrationForm) { if (!$this->sendEmailVerificationAction()) { return false; }

      $data = $registrationForm->getData(); $this->request->loadCookiesFor($data['email']); <<< line to add if (!$this->post(UrlBuilder::RESOURCE_CREATE_REGISTER, $registrationForm->toArray())) { return false; } if (!$this->sendRegistrationActions()) { return false; } return $this->completeRegistration(); }

``

  1. i change also the URL_BASE and HOST at \vendor\seregazhuk\pinterest-bot\src\Helpers\UrlBuilder.php i notice that pinterest not share correctly the cookies between subdomain const URL_BASE = 'https://www.pinterest.com/'; const HOST = 'www.pinterest.com';
  2. for the login still not working and an alternative and tomporary solution is using bot->register() to login like edited in (1)

this didnt work for me... call $bot->auth->register() function with existing account will return false

MaurieF commented 5 years ago

Thanks for the guidance @tuxado ... I cannot get $bot->auth->register() to work for an existing account. (1) I don't know if its relevant, but when logging in through Pinterest it sends requests to /_ngjs/resource/ActiveUserResource/create/ (GET) and /_ngjs/resource/StatsLogResource/create/ (POST) and /resource/UserRegisterTrackActionResource/update/ (POST) and /resource/ContextLogResource/create/ (POST)

(2) Current login request ($bot->auth->login()) returns... "resource_response":{"data":null,"error":{"code":"FULL_PAGE_NOT_ALLOWED_BY_ROUTE","target":"None","http_status":404}},

(3) See attached file (curltemp.txt) for Curl verbose log when calling $bot->auth-

login(username_or_or_email,password);

curltemp.txt

tuxado commented 5 years ago

It look like the login rework, if the main package not working use this update https://github.com/tuxado/php-pinterest-bot

I tested to login with the updated package with 5 account :

.

[INFO] Account : patrick.batz.@gmail.com > [INFO] Account login success [Info] sleeping... [INFO] Account : jmills.458@gmail.com > [INFO] Account login success [Info] sleeping... [INFO] Account : stewart.kutch.@gmail.com > [INFO] Account login success [Info] sleeping... [INFO] Account : herminio.marvin@gmail.com > [INFO] Account login success [Info] sleeping... [INFO] Account : fadel.thalia@gmail.com > [INFO] Account login success

but the pinterest ban is without mercy lol can any one suggest me a good and cheap proxy

anasnawaz commented 5 years ago

Error calling seregazhuk\PinterestBot\Api\Providers\User::isBanned method. You must log in before

login fail and return this error plz anyone can help me thanks advance @seregazhuk

anasnawaz commented 5 years ago

also your examples is not working @seregazhuk

tuxado commented 5 years ago

@anasnawaz use this package https://github.com/tuxado/php-pinterest-bot download it manually from the browser unzip it and copy and replace the main package on vendor/seregazhuk/php-pinterest

examples

$bot = PinterestBot::create();
$bot->auth->login("example@example.com", "password");
if($bot->auth->isLoggedIn())
{
    if (!$bot->user->isBanned()) 
    {
        echo ' > [INFO] Account login success';
    }
}
anasnawaz commented 5 years ago

bundle of thanks for help

On Tue, 12 Feb 2019 at 21:33, tuxado notifications@github.com wrote:

@anasnawaz https://github.com/anasnawaz use this package https://github.com/tuxado/php-pinterest-bot download it manually from the browser unzip it and copy and replace the main package on vendor/seregazhuk/php-pinterest

' $bot = PinterestBot::create(); $bot->auth->login("example@example.com", "password"); if($bot->auth->isLoggedIn()) { if (!$bot->user->isBanned()) { echo ' > [INFO] Account login success'; } }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/seregazhuk/php-pinterest-bot/issues/442#issuecomment-462831475, or mute the thread https://github.com/notifications/unsubscribe-auth/AizzzO-AETdf1seC5PxUwnfhPr08C8Prks5vMuy-gaJpZM4afvmK .

MaurieF commented 5 years ago

Thanks @tuxado The new fork does achieve login and I'm now able to run $bot->pins->activity($pinid,25) ->toArray(); which is login dependent.

seregazhuk commented 5 years ago

Thank you @tuxado Actually, the issue was only with the domain. You should use www.pinterest.com instead of country-specific uk.pintrerest.com 🤦‍♂️

Everybody, I have published a new release v5.9.1 with fixes. Please, update you versions.

MaurieF commented 5 years ago

Thanks @seregazhuk

ihturkmen commented 5 years ago

@seregazhuk Thanks 👍

buildingnicko commented 5 years ago

when my script loads in the browser there is an error "Sorry! We've had to block actions (logins) from your area because of suspicious activity. Please try again later." How can I handle it? pinterest

sonerss commented 5 years ago

Thank you @tuxado Actually, the issue was only with the domain. You should use www.pinterest.com instead of country-specific uk.pintrerest.com 🤦‍♂️

Everybody, I have published a new release v5.9.1 with fixes. Please, update you versions.

Hello,

How can I update php-pinterest-bot v5.9.1?

when I run "composer require seregazhuk/pinterest-bot" in cmd, it loads "Installing

seregazhuk/pinterest-bot (5.7.3): Loading from cache"

BR

tuxado commented 5 years ago

Thank you @tuxado Actually, the issue was only with the domain. You should use www.pinterest.com instead of country-specific uk.pintrerest.com man_facepalming Everybody, I have published a new release v5.9.1 with fixes. Please, update you versions.

Hello,

How can I update php-pinterest-bot v5.9.1?

when I run "composer require seregazhuk/pinterest-bot" in cmd, it loads "Installing

seregazhuk/pinterest-bot (5.7.3): Loading from cache"

BR

edit your composer.json "seregazhuk/pinterest-bot": "^5.9.1", and open CMD and type : composer update

or use require

composer require vendor/package:version

composer require seregazhuk/pinterest-bot:5.9.1

or

composer require vendor/package "version"

composer require seregazhuk/pinterest-bot "^5.9.1"

gonjumixproject commented 4 years ago

started to observe this issue now with v5.9.1 :(

mtnyvz16 commented 3 years ago

I'm having the same problems again :( Please help @seregazhuk @tuxado

policemal commented 3 years ago

v5.9.1 doesn't work on me either. I keep getting the following error. friends please help me. @seregazhuk @tuxado

... Error calling seregazhuk\PinterestBot\Api\Providers\User::isBanned method. You must log in before. in ...

garsamba commented 3 years ago

Thank you @tuxado Actually, the issue was only with the domain. You should use www.pinterest.com instead of country-specific uk.pintrerest.com man_facepalming Everybody, I have published a new release v5.9.1 with fixes. Please, update you versions.

Hello, How can I update php-pinterest-bot v5.9.1? when I run "composer require seregazhuk/pinterest-bot" in cmd, it loads "Installing seregazhuk/pinterest-bot (5.7.3): Loading from cache" BR

edit your composer.json "seregazhuk/pinterest-bot": "^5.9.1", and open CMD and type : composer update

or use require

composer require vendor/package:version

composer require seregazhuk/pinterest-bot:5.9.1

or

composer require vendor/package "version"

composer require seregazhuk/pinterest-bot "^5.9.1"

Iz there any update?