Emanuela Colta
Emanuela Colta

Reputation: 2207

Sign up with Twitter Error. Could not authenticate

I am trying to create a social registration system. So far I implemented the function for sign up with Facebook. Now, when trying to create the sign up with Twitter account, I implemented this:

var client = new Twitter({
    consumer_key: 'oN******',
    consumer_secret : 'Za****',
    access_token_key: '9*****',
    access_token_secret: 'N0*****'            
});

client.get( 'users/show.json', { id: '9***' }, function(error, user, response){
if( error ) { res.json( JSON.stringify( error ) );  return; }

I hardcoded my user id and my app id/secret, consumer key/ secret.

I keep getting the error:

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

Why does this error appear and how to solve it?

Upvotes: 4

Views: 2034

Answers (1)

Emanuela Colta
Emanuela Colta

Reputation: 2207

  1. I got back to my Twitter application on https://apps.twitter.com
  2. At Keys and Access Tokens page, I clicked on Regenerate My Access Token And Token Secret button (see below)

  3. I replaced them in my code

Now it works perfectly.

Upvotes: 4

Related Questions