3

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?

Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
Emanuela Colta
  • 2,129
  • 4
  • 18
  • 31

1 Answers1

4
  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.

Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
Emanuela Colta
  • 2,129
  • 4
  • 18
  • 31