我想在 Laravel8 上使用 Socialite 对 Twitter 进行身份验证,但它在本地有效,但我在 Heroku 上遇到错误

I want to authenticate Twitter using Socialite on Laravel8, but it works locally, but I get an error on Heroku

我想在 Laravel 8 中实现 Twitter 身份验证。
我正在使用 Socialite.
本地操作检查成功。
我通过 Twitter 进行了身份验证并能够获取名称。
当我部署到 Heroku 时,出现错误。
Heroku 的环境变量(TWITTER_KEY、TWITTER_REDIRECT_URI、TWITTER_SECRET)已设置。

heroku run composer show -i

laravel / socialite and socialiteproviders/twitter and socialiteproviders/manager has been uploaded to heroku.

[状态] 从 Laravel8 应用程序启动 Twitter 身份验证时出错。

League\OAuth1\Client\Signature\HmacSha1Signature::League\OAuth1\Client\Signature\{closure}(): Argument #2 ($value) must be passed by reference, value given

[环境] 英雄库 Laravel8 社会责任
我不擅长英语,但我会尽力而为。谢谢。

此错误已在此处解决:https://github.com/thephpleague/oauth1-client/issues/127 我要求发布新版本。因此,您要么等待新版本,要么(暂时)需要最新的开发版本,其中包括错误修复:

composer require league/oauth1-client:dev-master

我只想分享我想到的另一个解决方案。因为错误只发生在 PHP 8 上,您也可以将您的作曲家要求更改为不使用 PHP 8(如果您没有依赖于该版本的要求)。

要更改它,您可以编辑 composer.json 文件并更改此行:

    "require": {
        "php": "^7.3|^8.0",

对此:

    "require": {
        "php": "^7.3",

然后 运行 composer update。希望对其他遇到此问题的人有用