Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.5.0 updateStatus error #74

Open
twojcik opened this issue Sep 21, 2012 · 18 comments
Open

v0.5.0 updateStatus error #74

twojcik opened this issue Sep 21, 2012 · 18 comments

Comments

@twojcik
Copy link

@twojcik twojcik commented Sep 21, 2012

Hi,
When I updated code to v0.5.0 updateStatus function returns :

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

Reverting back to 0.4 works . I assume it's connected with twitter API 1.1 ?

@fender
Copy link

@fender fender commented Oct 2, 2012

Same error for me, any ideas?

@fender
Copy link

@fender fender commented Oct 2, 2012

My code:

var twitter = require('ntwitter');
var credentials = require('./credentials.js');

var t = new twitter({
    consumer_key: credentials.consumer_key,
    consumer_secret: credentials.consumer_secret,
    access_token_key: credentials.access_token_key,
    access_token_secret: credentials.access_token_secret
});

t.stream('user', {'with':'user'}, function(stream) {
  stream.on('data', function (data) {
    // console.log(data);
    if ('text' in data) {
      if (data.text.toLowerCase() == "@pbtest001 start") {
        t.verifyCredentials(function (err, data) {
          console.log(err);
          // console.log(data);
        })
        .updateStatus('pickup started!',
          function (err, data) {
            console.log(err);
            // console.log(data);
          }
        );
      }
    }
  });
  stream.on('end', function (response) {
    // Handle a disconnection
  });
  stream.on('destroy', function (response) {
    // Handle a 'silent' disconnection from Twitter, no end/error event fired
  });
});

And the error returned from updateStatus:

{ [Error: HTTP Error 401: Unauthorized, API message: {"errors":[{"message":"Coul
d not authenticate you","code":32}]}]
  data: '{"errors":[{"message":"Could not authenticate you","code":32}]}',
  statusCode: 401 }
@supernayan
Copy link

@supernayan supernayan commented Oct 3, 2012

I'm getting this error as well... and on DMs

@AvianFlu
Copy link
Owner

@AvianFlu AvianFlu commented Oct 3, 2012

This is a bug in the oauth dependency - as I understand it, it's already fixed upstream. I'll look into it and release a fixed version ASAP.

@tylor
Copy link

@tylor tylor commented Oct 3, 2012

I was having the same problem and found that having characters like exclamation points and apostrophes in the message was the problem.

As mentioned, the issue seems to be upstream in node-oauth, where these characters are not being properly escaped. See ciaranj/node-oauth#113 (comment) and ciaranj/node-oauth#114 for a better description and some possible solutions.

Thanks @AvianFlu for looking into this.

@nayanjain
Copy link

@nayanjain nayanjain commented Oct 3, 2012

Does it escape correctly in 0.4.1?

@tylor
Copy link

@tylor tylor commented Oct 3, 2012

0.4.1 uses the old Twitter REST API (v0.4.1...v0.5.0L1R7), which seems to be a little more forgiving to unescaped characters.

@nayanjain
Copy link

@nayanjain nayanjain commented Oct 5, 2012

Any resolution?

@impronunciable
Copy link

@impronunciable impronunciable commented Oct 7, 2012

I had the same situation testing my library. I think the problem is related with the app credentials. Try creating a new app if you are using the REST API V1.1.

@brentertz
Copy link

@brentertz brentertz commented Oct 10, 2012

Having the same issue. Reverted to v0.4.1 as temporary solution.

@guyht
Copy link

@guyht guyht commented Oct 22, 2012

Is there any update on this? One of my applications is quite seriously affected by this bug.

@ghost
Copy link

@ghost ghost commented Oct 22, 2012

yep @guyht
[quote @tylor] As mentioned, the issue seems to be upstream in node-oauth, where these characters are not being properly escaped. See ciaranj/node-oauth#113 and ciaranj/node-oauth#114 for a better description and some possible solutions.

So you just need to replace this code:
https://github.com/rolandboon/node-oauth/commit/240a992553ade34ce8a3f970d9c1c21eebd6ff85

or this:
https://github.com/jamescauwelier/ntwitter/commit/0756426e60c44d1a9de19c5a96e0de078926a114

:)

@nickcheng
Copy link

@nickcheng nickcheng commented Oct 23, 2012

Thanks @preziusoftware

The node-oauth patch rolandboon/node-oauth@240a992 solved the issue.

@ghost
Copy link

@ghost ghost commented Oct 23, 2012

:) you most welcome

@jedt
Copy link

@jedt jedt commented Nov 28, 2012

This also applies with the twitter stream

streamFilter = { track: 'that\'s cool' };
twitter.stream('statuses/filter', streamFilter, function handleStream(stream) {
    stream.on('error', function(err, data){
        console.log(err);
        console.log(data);
    });
})

It returns a 401 error

@jedt
Copy link

@jedt jedt commented Nov 28, 2012

Everyone, I applied the patch mentioned by @kaosdynamics and it worked perfectly.

@heikkiv
Copy link

@heikkiv heikkiv commented Nov 28, 2012

Looks like the issue is now fixed in node-oauth ciaranj/node-oauth@45a983e Hopefully we'll have an updated npm package soon.

@jfhbrook
Copy link

@jfhbrook jfhbrook commented Dec 16, 2012

+2 plz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.