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

Make Rfc3986 encoding optional #5

Closed jmendiara closed 9 years ago

jmendiara commented 10 years ago

Nice work, congrats for your effort.

Some frameworks, like angularjs, encode parameters in their own core.

Therefore, using your library to calculate signatures can lead to a double encoding, making necessary to decode your encode to encode it again later.

var oauth_signature = decodeURIComponent(oauthSignature.generate(...));

Would you mind to add an optional boolean parameter encode (true by default) to your OAuthSignature.prototype.generate? (or any other solution)

I can proceed with the PR if you agree

bettiolo commented 10 years ago

@jmendiara Thank you very much for pointing me out your use case. Please feel free to make a PR or otherwise I will implement it for you. Let me know if you have an open-source project using my library, as I would like to see how you integrated.

jmendiara commented 10 years ago

@bettiolo here you have! I hope I can release the library is using your project soon. I'll ping you ;)

bettiolo commented 10 years ago

@jmendiara thanks for the pull request!

I will review and merge it beginning of next week. I need to check and eventually add some tests.

Sorry for the delay.

jmendiara commented 9 years ago

Any updates on this?

bettiolo commented 9 years ago

Sorry, I had an accident and was not able to code. I am going to address this in the upcoming week.

I need to understand if angularjs is encoding parameters following the RFC3986 specification

jmendiara commented 9 years ago

oh! hope you have gotten better!

I need to understand if angularjs is encoding parameters following the RFC3986 specification

This PR is about not encoding inside your library. Angular here was used as an example of an HTTP request client, but it's not the only one.

BTW, here you have some references about Angular and RFC3986

bettiolo commented 9 years ago

I merged you pull request, added unit tests around it and changed the main method signature from a bool parameter to an object with properties to make it easier to eventually extend the functionality without breaking the api. I bumped the version to 1.2.1.