Reputation: 49
I know that there is a very similar question like this one on StackOverflow, but i do not understand what the answer means, and because of that i am asking this question.
here's my code
const tokens = JSON.parse(fs.readFileSync("./tokens.json"));
const { accessToken, accessSecret, oauth_verifier } = tokens;
const client = new TwitterApi({
appKey: process.env.API_KEY,
appSecret: process.env.API_KEY_SECRET,
accessToken: accessToken,
accessSecret: accessSecret
});
const {client: Bot} = await client.login(oauth_verifier);
running this throws a 401 error with data saying Request token missing: ''.
i believe the problem lies in the oauth_verifier, as the code runs fine, and i have checked all my other credentials. I can also run a console.log()
without running into errors if the last line in my code block above is commented.
Upvotes: 0
Views: 2348
Reputation: 11
Try including oauth_token_secret as received in step 1 (getting Auth URL). That worked for me .
Upvotes: 1
Reputation: 660
The secret for getting this to work for me was not using .login().
Just instantiate the client using the details you got from the OAuth 1.0 auth flow. No need for .login()
Upvotes: 0