首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Twitter API v2错误“您目前有必要的访问.”

Twitter API v2错误“您目前有必要的访问.”
EN

Stack Overflow用户
提问于 2022-02-14 14:32:05
回答 1查看 3.1K关注 0票数 1

我正在尝试用twitter v2 (npm/twitter-api-v2)创建一个tweet。但我得到的错误如下:

代码语言:javascript
运行
复制
ApiResponseError: Request failed with code 403 - You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. You can learn more here: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve (Twitter code 453)

我的代码

代码语言:javascript
运行
复制
import { TwitterApi } from "twitter-api-v2";
import "dotenv/config";

var client = new TwitterApi({
   appKey: process.env.APP_KEY,
   appSecret: process.env.APP_SECRET,
   accessToken: process.env.ACCESS_TOKEN,
   accessSecret: process.env.ACCESS_SECRET,
}); 

client.v1
      .tweet("This tweet was written by a bot")
      .then((val) => {
         console.log(val);
         console.log("success");
      })
      .catch((err) => {
         console.log(err);
      });

(预先谢谢:)

EN

Stack Overflow用户

发布于 2022-03-03 18:35:50

您正在使用twitter-api-v2节点包,然后使用调用V1.1API的client.v1,您无法访问该包。读取节点库的文档和错误消息-答案就在那里。您需要请求提升的访问权限才能使用特定的API调用集。

票数 -1
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71113517

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档