API PHP 中的 Pinterest - 登录失败

API Pinterest in PHP - Login failed

我使用 seregazhuk/php-pinterest-bot(在 Symfony 4 中)在 Pinterest (v5.9.0) 上添加图钉。当我尝试登录时,出现错误。这是我的代码:

    $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

当我查看日志时,出现以下错误:

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

我已经检查过我的邮件、我的用户名和我的密码。我可以和他们成功连接。

怎么了?

看起来您正在使用的库已经有一段时间没有工作了:

https://github.com/seregazhuk/php-pinterest-bot/issues/442

问题已于几天前在新版本 5.9.1 发布后得到解决。现在,您可以再次使用它。下面的方法returns应该是真的:

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