bettiolo / oauth-signature-js

JavaScript OAuth 1.0a signature generator (RFC 5849) for node and the browser
https://www.npmjs.com/package/oauth-signature
BSD 3-Clause "New" or "Revised" License
232 stars 71 forks source link

Generate invalid oauth signature #41

Closed cenezoic12 closed 6 years ago

cenezoic12 commented 6 years ago

I imported the package in my angular project, my issue is that the function generate an invalid oauth signature. I tried to match it http://bettiolo.github.io/oauth-reference-page/ with the same data/parameters but the oauth signature does not match. Here's my code.

var httpMethod = 'GET';
var url = 'https://api.xero.com/oauth/RequestToken';
this.parameters = {
    oauth_consumer_key : '<consumer key>',
    oauth_nonce : '366871832',
    oauth_timestamp : '1521616286',
    oauth_signature_method : 'HMAC-SHA1',
    oauth_version : '1.0'

};
var consumerSecret = '<consumer secret>';
var encodedSignature = oauth.generate(httpMethod, url, this.parameters,consumerSecret);
var signature = oauth.generate(httpMethod, url, this.parameters, consumerSecret,
  { encodeSignature: false });
bettiolo commented 6 years ago

Does either work with xero.com?

cenezoic12 commented 6 years ago

Now it works fine sir..I really don't know why the last time I tried to use the package didn't worked..thanks sir.