+ Start a Discussion
Valery LebedzValery Lebedz 

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



If more information is needed please ask.

I will appreciate any help.



Hi Valery,

Did you find an answer to this ?


Abhishek SolankiAbhishek Solanki
Hi Valery and Rup,
Did you find an answer to the above query? Please let me know if we have a solution here.