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

Comments

Projects
None yet
@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

This comment has been minimized.

Show comment
Hide comment
@fender

fender Oct 2, 2012

Same error for me, any ideas?

fender commented Oct 2, 2012

Same error for me, any ideas?

@fender

This comment has been minimized.

Show comment
Hide comment
@fender

fender 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 }

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

This comment has been minimized.

Show comment
Hide comment
@supernayan

supernayan Oct 3, 2012

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

supernayan commented Oct 3, 2012

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

@AvianFlu

This comment has been minimized.

Show comment
Hide comment
@AvianFlu

AvianFlu Oct 3, 2012

Owner

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.

Owner

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

This comment has been minimized.

Show comment
Hide comment
@tylor

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

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

This comment has been minimized.

Show comment
Hide comment
@nayanjain

nayanjain Oct 3, 2012

Does it escape correctly in 0.4.1?

nayanjain commented Oct 3, 2012

Does it escape correctly in 0.4.1?

@tylor

This comment has been minimized.

Show comment
Hide comment
@tylor

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

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

This comment has been minimized.

Show comment
Hide comment
@nayanjain

nayanjain Oct 5, 2012

Any resolution?

nayanjain commented Oct 5, 2012

Any resolution?

@impronunciable

This comment has been minimized.

Show comment
Hide comment
@impronunciable

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

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

This comment has been minimized.

Show comment
Hide comment
@brentertz

brentertz Oct 10, 2012

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

brentertz commented Oct 10, 2012

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

@guyht

This comment has been minimized.

Show comment
Hide comment
@guyht

guyht Oct 22, 2012

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

guyht commented Oct 22, 2012

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

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost 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

:)

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

This comment has been minimized.

Show comment
Hide comment
@nickcheng

nickcheng Oct 23, 2012

Thanks @preziusoftware

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

nickcheng commented Oct 23, 2012

Thanks @preziusoftware

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

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Oct 23, 2012

:) you most welcome

ghost commented Oct 23, 2012

:) you most welcome

@jedt

This comment has been minimized.

Show comment
Hide comment
@jedt

jedt 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 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

This comment has been minimized.

Show comment
Hide comment
@jedt

jedt Nov 28, 2012

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

jedt commented Nov 28, 2012

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

@heikkiv

This comment has been minimized.

Show comment
Hide comment
@heikkiv

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

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

This comment has been minimized.

Show comment
Hide comment
@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