Absolventa/emarsys-rb

Broken authorization

Closed this issue · 3 comments

This commit: #9 breaks authorization for me.
I get Emarsys::Unauthorized: HTTP-Code: 401, Emarsys-Code: 1 - Unauthorized Time frame is invalid

Does it work for anyone? What's the point?

@spajic, this PR fixed a security issue in the library, namely nonce reuse. See the official documentation for more details on this. As for the timeframe issue, you are receiving this error because the Date you use to calculate the signature is not within 5 minutes of the actual time.

Emarsys servers return the Date in their response headers, so you can use that to check time your signature is compared against.

Free to contact your Emarsys representative as they will surely be able to help!

@felin-arch Thank you! I'll check it out.

Fixed as of PR #19