Describe the bug
I'm new to javascript and I'm trying to use the delete_tweets.js code provided in the Twitter-API-v2-sample-code. After copying over most of the code, and making a few small changes, I am encountering a HTTP 403 error. Furthermore, I'm seeing lots of type errors when using the "got" package. I've downgraded the package to install a pre-pure-ESM version (i.e., npm install got@"<12.0.0"). The full output of the error is:
To Reproduce
I've installed all the dependencies listed in the README for javascript. I've made a couple of minor changes. The first change I made is to use a .txt file to store my credentials, so at the beginning of the script I read them in using PapaParse:
I also used this credentials variable when passing in my access_token, so I've replaced some code:
(async () => {
try {
// ########################################################
// THIS CODE IS COMMENTED OUT BUT IS PART OF THE ORIGINAL SCRIPT
// // Get request token
// const oAuthRequestToken = await requestToken();
// // Get authorization
// authorizeURL.searchParams.append(
// "oauth_token",
// oAuthRequestToken.oauth_token
// );
// console.log("Please go here and authorize:", authorizeURL.href);
// const pin = await input("Paste the PIN here: ");
// // Get the access token
// const oAuthAccessToken = await accessToken(oAuthRequestToken, pin.trim());
// ########################################################
const oAuthAccessToken = {
"oauth_token": credentials.access_token,
"oauth_token_secret": credentials.access_token_secret,
"screen_name": "my-screen-name--this-is-fake",
"user_id": credentials.access_token.split("-")[0],
};
// Make the request
const response = await getRequest(oAuthAccessToken);
console.dir(response, {
depth: null,
});
} catch (e) {
console.log(e);
process.exit(-1);
}
process.exit();
}) ();
I doubt that using this credentials file is changing much, but as a dummy check, I used the commented out method (i.e., getting a PIN from my app) and got the following error:
Describe the bug I'm new to javascript and I'm trying to use the
delete_tweets.js
code provided in the Twitter-API-v2-sample-code. After copying over most of the code, and making a few small changes, I am encountering a HTTP 403 error. Furthermore, I'm seeing lots of type errors when using the "got" package. I've downgraded the package to install a pre-pure-ESM version (i.e.,npm install got@"<12.0.0"
). The full output of the error is:The header I am submitting is:
To Reproduce I've installed all the dependencies listed in the README for javascript. I've made a couple of minor changes. The first change I made is to use a .txt file to store my credentials, so at the beginning of the script I read them in using PapaParse:
I also used this
credentials
variable when passing in myaccess_token
, so I've replaced some code:I doubt that using this credentials file is changing much, but as a dummy check, I used the commented out method (i.e., getting a PIN from my app) and got the following error:
Expected behavior I expect that I can pass in a tweet ID and it would get deleted.