node-oauth icon indicating copy to clipboard operation
node-oauth copied to clipboard

getOAuthRequestToken returns undefined oauth_token

Open shankie-codes opened this issue 9 years ago • 1 comments

I'm having a bit of a strange problem with certain return values in getOAuthRequestToken(). I've had it working with certain return values, but with the return querystring below (i.e. what you get if you log the results of data here, the oauth_token passed to the callback is undefined. The query in question:

oauth_token=FXQikSiU2mRmwGsGyA3rIhZd&oauth_token_secret=Wj6ECbsLDqBETsSHUMsFrYWYNPBHKETCG7c0PH2gBvzkstlz&oauth_callback_confirmed=true

Oddly enough, if you log the value of results, you can see that results.oauth_token has a value (i.e. not undefined!); however, if you try to access the value of results.oauth_token in your console, you get undefined. This is obviously why it's passing undefined as the second argument of the callback.

I've done a bit of digging, and it appears to simply be a problem with the first parameter given in the query string. For example, if I modify the value that my server sends back as a query string so that it reads:

bumpf=bumpf&oauth_token=FXQikSiU2mRmwGsGyA3rIhZd&oauth_token_secret=Wj6ECbsLDqBETsSHUMsFrYWYNPBHKETCG7c0PH2gBvzkstlz&oauth_callback_confirmed=true

then var results= querystring.parse(data); works correctly and the correct oauth_token is sent to my callback.

In the short-term I'm happy to have my server modified to send back some bumpf as the first parameter, but I'd like to understand why this is happening! It's obviously not happening all the time as it's pretty fundamental (and I've successfully tested the module with Twitter).

Thanks

shankie-codes avatar Oct 28 '15 12:10 shankie-codes

It feels related to this issue, though it's happening at a different time (request vs. authorize)

shankie-codes avatar Oct 28 '15 12:10 shankie-codes