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

Twitter 401s cause everyauth to crash #59

Closed
jamesarosen opened this issue Aug 27, 2011 · 1 comment
Closed

Twitter 401s cause everyauth to crash #59

jamesarosen opened this issue Aug 27, 2011 · 1 comment

Comments

@jamesarosen
Copy link

To replicate:

  1. set up everyauth with an express server and invalid Twitter credentials
  2. go to /auth/twitter

What happens:

/private/tmp/meat.me/node_modules/everyauth/lib/modules/twitter.js:43
    return new Error(data.data.match(/<error>(.+)<\/error>/)[1]);
                                                            ^
TypeError: Cannot read property '1' of null
    at /private/tmp/meat.me/node_modules/everyauth/lib/modules/twitter.js:43:61
    at /private/tmp/meat.me/node_modules/everyauth/lib/step.js:97:21
    at [object Object].fail (/private/tmp/meat.me/node_modules/everyauth/lib/promise.js:53:24)

The problem is that Twitter is now returning data of the form

{
  "statusCode": 401,
  "data": "Failed to validate oauth signature and token"
}

Thus, data.data does not match /<error>(.+)<\/error>/ and that test returns null.

@nilya
Copy link

nilya commented Aug 30, 2011

Also crash can be caused by promise.fail(err) in one of the steps.
For example if findOrCreateUser returns DB error everyauth crashes with

/project/node_modules/everyauth/lib/modules/google.js:47
    return new Error(data.data.match(/H1>(.+)<\/H1/)[1]);
                               ^
TypeError: Cannot call method 'match' of undefined
    at /project/node_modules/everyauth/lib/modules/google.js:47:32

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

No branches or pull requests

3 participants