Twitter API v2:403 禁止 - “使用附加到项目的 Twitter 开发者应用程序中的密钥”

问题描述 投票:0回答:1

我使用 Laravel/Socialite 与 Twitter API v2 交互已经有一段时间了,直到上周一切都工作正常。我遇到“403 Forbidden”错误,并显示以下消息:

 Client error: `GET https://api.twitter.com/2/users/me?user.fields=profile_image_url` resulted in a `403 Forbidden` {"client_id":"xxxxxxx","detail":"When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project"}

我采用免费计划,并且我已确认我的 Twitter 开发者应用程序与某个项目关联。以下是有关我的设置的一些详细信息:

Laravel/框架:“^9.19”, Laravel/Socialite 版本:“^5.5” Twitter 开发者应用程序详细信息:[应用程序权限:'users.read'、'tweet.read'] 发生错误的代码片段:

$user = Socialite::driver('twitter-oauth-2')->user();

我很困惑为什么会突然出现这个问题以及如何解决它。任何指导或见解将不胜感激!

提前谢谢您!

laravel twitter oauth-2.0 twitter-oauth laravel-socialite
1个回答
0
投票

不确定具体原因。

user()
调用
https://api.twitter.com/2/users/me
https://github.com/laravel/socialite/blob/5.x/src/Two/TwitterProvider.php#L57-L65),这是由免费计划支持的( https://developer.twitter.com/en/portal/products/free)。

我用邮递员尝试了该 api,并且可以确认我可以成功找回用户。

© www.soinside.com 2019 - 2024. All rights reserved.