Kong / mashape-oauth

OAuth Modules for Node.js - Supporting RSA, HMAC, PLAINTEXT, 2,3-Legged, 1.0a, Echo, XAuth, and 2.0
http://oauthbible.com
MIT License
1.77k stars 186 forks source link

authHeader() throws "TypeError: context.hasOwnProperty is not a function" when body is a query string #28

Open laurence-myers opened 7 years ago

laurence-myers commented 7 years ago

authHeader() -> prepareParameters() -> utils.extend()

prepareParameters() parses the body using "querystring"."parse()". utils.extend then attempts to call ".hasOwnProperty()" on the parsed querystring object. This property doesn't exist, due to missing prototype inheritance. The node.js documentation states:

Note: The object returned by the querystring.parse() method does not prototypically inherit from the JavaScript Object. This means that typical Object methods such as obj.toString(), obj.hasOwnProperty(), and others are not defined and will not work.

Tested on Node v6.9.1.

jakezatecky commented 7 years ago

Should already be resolved with #26, but that fix has not be published to npm yet. See #29.