Skip to content

Conversation

@rufman
Copy link

@rufman rufman commented Aug 1, 2013

... Amazon does not like other chars such as = to be encoded in the signature, so encoding the whole url doesn't work

…ed. Amazon does not like other chars such as = to be encoded in the signature, so encoding the whole url doesn't work
@lukasz-madon
Copy link

👍 yes I had the same problem problem.

"HMAC request signatures must be Base64 encoded. Base64 encoding converts the signature into a simple ASCII string that can be attached to the request. Characters that could appear in the signature string like plus (+), forward slash (/), and equals (=) must be encoded if used in a URI. For example, if the authentication code includes a plus (+) sign, encode it as %2B in the request. Encode a forward slash as %2F and equals as %3D."

You don't need to encode in js, just remove decodeURIComponent and encode whole server side. Code: https://coderwall.com/p/56a9ja

@rpavez
Copy link

rpavez commented Apr 23, 2014

Use this:
signature = signature.replace(/(<([^>]+)>)/ig,"");
signature = signature.replace(/+/g, "%2B");
signature = signature.replace(///g, "%2F");
signature = signature.replace(/=/g, "%3D");

@tadruj
Copy link
Owner

tadruj commented Oct 3, 2014

Can you please provide some more info in which case this doesn't work? I'll try to avoid regexp hacks if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants