我正在尝试用twitter v2 (npm/twitter-api-v2
)创建一个tweet。但我得到的错误如下:
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)
我的代码
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);
});
(预先谢谢:)
发布于 2022-03-03 18:35:50
您正在使用twitter-api-v2
节点包,然后使用调用V1.1API的client.v1
,您无法访问该包。读取节点库的文档和错误消息-答案就在那里。您需要请求提升的访问权限才能使用特定的API调用集。
https://stackoverflow.com/questions/71113517
复制相似问题