对 Twitter API v2 端点的请求进行身份验证时

Ale*_*uba 3 twitter twitter-api-v2

我在验证对 Twitter API v2 端点的请求时遇到通知。

{
  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. You can create a project via the developer portal.',
  registration_url: 'https://developer.twitter.com/en/docs/projects/overview',
  title: 'Client Forbidden',
  required_enrollment: 'Appropriate Level of API Access',
  reason: 'client-not-enrolled',
  type: 'https://api.twitter.com/2/problems/client-forbidden'
}
Run Code Online (Sandbox Code Playgroud)

我正在使用免费套餐。请指导我如何解决这个问题!我在这里使用代码片段

Mar*_*nen 6

正如Twitter API 的最新摘要中所述,免费层不允许获取推文,而这似乎正是您想要做的。

您至少需要基本访问层,该层不是免费的。您可以在开发者门户的仪表板中订阅它,即https://developer.twitter.com/en/portal/dashboard

您需要有一个项目,并且您的应用程序应该位于该项目中。应用程序应仅使用 V2 API 处理除媒体上传和 v1.1 Oauth 之外的所有事务,因为其他 v1.1 API 不再可用。

值得查看Twitter 开发者论坛上的最新公告,以便您了解使用 Twitter API 的最新要求。

此外,该论坛目前充斥着有关迁移到最新层、V2 API 以及处理 Twitter 开发人员帐户上似乎出现的技术故障的问题,因此对于许多问题可能已经有解决方案或至少有用的提示。Twitter 开发者论坛主页: https: //twittercommunity.com/