Skip to content

'Could not authenticate you.' #581

@mikeymurph77

Description

@mikeymurph77

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions