Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

findOrCreateUser returning undefined user for tumblr? #244

Open
gonzoramos opened this Issue · 1 comment

2 participants

gonzoramos Philipp Küng
gonzoramos

Hi,

I am pretty new with everyauth, and I am blocked by a possible error / bug / silly thing on my part. I follow all of the instructions I can find but I have not been able to succesfully use the module to authenticate with tumblr. The key part that fails is:

everyauth.tumblr
  .consumerKey('mykey')
  .consumerSecret('mysecret')
  .findOrCreateUser( function (session, accessToken, accessSecret, tumblrUser) {
    return usersByTumblrName[tumblrUser.name] ||
      (usersByTumblrName[tumblrUser.name] = addUser('tumblr', tumblrUser));
  })
  .redirectPath('/');

where tumblrUser returns as 'undefined'. I even tried the example and it fails there as well...

/Users/gonzalo/Documents/Github/misc/prototypes/gonzalo-sites/myfeed/node_modules/everyauth/lib/modules/everymodule.js:348
  throw err;
        ^
TypeError: Cannot read property 'name' of undefined
    at Object._findOrCreateUser (/Users/gonzalo/Documents/Github/misc/prototypes/gonzalo-sites/myfeed/node_modules/everyauth/example/server.js:296:40)
    at Object.exec (/Users/gonzalo/Documents/Github/misc/prototypes/gonzalo-sites/myfeed/node_modules/everyauth/lib/step.js:47:21)
    at /Users/gonzalo/Documents/Github/misc/prototypes/gonzalo-sites/myfeed/node_modules/everyauth/lib/stepSequence.js:26:38
    at [object Object].fulfill (/Users/gonzalo/Documents/Github/misc/prototypes/gonzalo-sites/myfeed/node_modules/everyauth/lib/promise.js:42:25)
    at /Users/gonzalo/Documents/Github/misc/prototypes/gonzalo-sites/myfeed/node_modules/everyauth/lib/stepSequence.js:29:23
    at [object Object].fulfill (/Users/gonzalo/Documents/Github/misc/prototypes/gonzalo-sites/myfeed/node_modules/everyauth/lib/promise.js:42:25)
    at Parser.<anonymous> (/Users/gonzalo/Documents/Github/misc/prototypes/gonzalo-sites/myfeed/node_modules/everyauth/lib/modules/tumblr.js:18:17)
    at Parser.emit (events.js:67:17)
    at Object.onclosetag (/Users/gonzalo/Documents/Github/misc/prototypes/gonzalo-sites/myfeed/node_modules/everyauth/node_modules/xml2js/lib/xml2js.js:120:24)
    at emit (/Users/gonzalo/Documents/Github/misc/prototypes/gonzalo-sites/myfeed/node_modules/everyauth/node_modules/xml2js/node_modules/sax/lib/sax.js:322:32)

Any help would be greatly appreciated!
-G

Philipp Küng

Hi @gonzoramos,

Do you happen to have multiple tumblr-blogs registered with your username?

In that case the error is within /lib/modules/tumblr.js on line 17. (https://github.com/bnoguchi/everyauth/blob/master/lib/modules/tumblr.js).
Because tumblr is returning an XML response with multiple tumblelog entries those get converted into a JS array by xml2js. With the current implementation however result.tumblelog get's treated as single object which results in the object being undefined and therefore having no .name property.

If you only have one tumblelog registered i'd be nice to have a look at your XML response, to get it put console.log(data); on line 14 of tumblr.js.

Philipp Küng philippkueng referenced this issue from a commit in philippkueng/everyauth
Philipp Küng philippkueng fix for issue #244 where the tumblr module is returning an undefined …
…user when there are multiple tumblelogs associated to the account.
491f836
Jeff Zabel jzabel referenced this issue from a commit
Philipp Küng philippkueng fix for issue #244 where the tumblr module is returning an undefined …
…user when there are multiple tumblelogs associated to the account.
010ce78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.