phppinterest

API Pinterest in PHP - Login failed


I used seregazhuk/php-pinterest-bot (in Symfony 4) to add pin on Pinterest (v5.9.0). When I tried to log in, something failed. Here my code:

    $mail = getenv("PINTEREST_MAIL");
    $pwd = getenv("PINTEREST_PASSWORD");

    $bot = PinterestBot::create();
    $res = $bot->auth->login($mail, $pwd); // return false

    $bot->getLastError(); // return NULL

    $boards = $bot->boards->forUser($username); // failed

When I look in logs, I've got the following error:

Uncaught PHP Exception seregazhuk\PinterestBot\Exceptions\AuthRequired: "Error calling seregazhuk\PinterestBot\Api\Providers\Pins::create method. You must log in before."

I've already checked my mail, my username, and my password. I can connect successfully with them.

What's wrong?


Solution

  • Issue was solved a few days ago after the publication of a new release 5.9.1. Now, you can use it again. The following method returns true as it should be:

    $res = $bot->auth->login($mail, $pwd); // return true