ttezel / twit

Twitter API Client for node (REST & Streaming API)
4.31k stars 568 forks source link

'Could not authenticate you.' #581

Open mikeymurph77 opened 1 year ago

mikeymurph77 commented 1 year ago

I am trying to log in to post tweets on behalf of my own account from my app. I have not been able to move past the following error:

{ errors: [ { code: 32, message: 'Could not authenticate you.' } ] }

Previously I was using a different Twitter client which had issues with authentication and how my keys were generated.

The following is my code that fails to authenticate.

// /utils/twitterConfig.js
module.exports = {
  consumer_key: process.env.TWITTER_API_KEY,
  consumer_secret: process.env.TWITTER_API_SECRET,
  access_token: process.env.TWITTER_ACCESS_TOKEN,
  access_token_secret: process.env.TWITTER_ACCESS_SECRET,
};
// index.js
import twitterConfig from "../utils/twitterConfig";
import twit from "twit";
...
const Twitter = new twit(twitterConfig);
const tweets = Twitter.get(
        "search/tweets",
        { q: "banana since:2011-07-11", count: 100 },
          function (err, data, response) {
            console.log(data);
        }
);

Any idea what's going on here?

ShayanJa commented 1 year ago

Believe you need elevated access on twitter api

tylerpashigian commented 1 year ago

Did you ever figure this out? I just started getting this on a combination of keys/secrets that have been working for months. Do you know if this is related to the new twitter API rate limit?

geneoes commented 1 year ago

Did you ever figure this out? I just started getting this on a combination of keys/secrets that have been working for months. Do you know if this is related to the new twitter API rate limit?

@tylerpashigian happening the same to me here, did you figure this out already?

tylerpashigian commented 1 year ago

Did you ever figure this out? I just started getting this on a combination of keys/secrets that have been working for months. Do you know if this is related to the new twitter API rate limit?

@tylerpashigian happening the same to me here, did you figure this out already?

Yeah, it looks like the new API changes finally went into effect. If you go to your developer dashboard for the account you're trying to access, you'll see that account/project is suspended (assuming you have the same issue I did).

I just had to select an API tier (I selected free) and agree to it, I was good to go after that.