You need to sign in to do that
Don't have an account?

Troubles with OAuth 1.0 signature
Hi everybody,
I'm having some troubles with OAuth 1.0
Here i got some data.
requst token url - 'https://api.demo.com/requestToken'
consumer key like - 'demoHelloWorld'
consumer secret like - 'demoHelloWorldSecret'
signature method is - 'HMAC-SHA1'
some nonce like - 'GpNODMzhMP0'
and timestamp like - '1330114249'
all i'm doing is sending POST request to request token URL with header called 'Authorization' and
OAuth oauth_nonce="GpNODMzhMP0", oauth_signature_method="HMAC-SHA1", oauth_signature="r6LRsHFDqNu05oLaxSGn/dXZpIo=", oauth_timestamp="1330114249", oauth_consumer_key="demoHelloWorld", oauth_version="1.0"
in it.
Status code of response is 401 - Unauthorized .
From OAuth docs i found that this means one or more of this points: "Invalid Consumer Key Invalid / expired Token Invalid signature Invalid / used nonce"
I suppose that the issue is in generating correct signature.
Can somebody describe how should i do this?
Here how i do this :
Blob hash = Crypto.generateMac('hmacSHA1',Blob.valueOf(myData),Blob.valueOf(consumer_key)); String signature= EncodingUtil.urlEncode(EncodingUtil.base64Encode(hash), 'UTF-8');
'myData' is string generated from Request type, URL and params for this example it will look like
'POST&https%3A%2F%2Fapi.demo.com%2FrequestToken&oauth_consumer_key%3DdemoHelloWorld%26oauth_nonce%3DGpNODMzhMP0%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1330114249%26oauth_version%3D1.0'
If more information is needed please ask.
I will appreciate any help.
Thanks
Hi Valery,
Did you find an answer to this ?
Rup
Did you find an answer to the above query? Please let me know if we have a solution here.
Thanks!