function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VidhiVidhi 

OAuth signature issue for getting the token

Hello Friends,

 

I am trying to get the access token via Oauth 1.0 .But every time I am getting Oauth signature_invalid error.My header 

baseString = 'MyEndPoint'+'&'+EncodingUtil.urlEncode('oauthcallbackcall back PAge&oauth_consumer_key=myconsumerkey&oauth_nonce='+String.valueOf(Crypto.getRandomLong())+'&oauth_signature_method=HMAC-SHA1&oauth_timestamp='+String.valueOf(DateTime.now().getTime() / 1000)+ '&oauth_version=1.0','UTF-8');

 

I am getting the signature via    

Blob OAuth = Crypto.generateMac('hmacSHA1' , Blob.valueOf(baseString) , Blob.valueOf(signkey));

 

my signKey is :  signkey = consumer_secret+'&';

 

 oauth_signature = EncodingUtil.urlEncode(EncodingUtil.base64Encode(OAuth),'UTF-8');  

 

 

Can Anybody tell me where i am doing the mistake for doing the process.Any immediate help will be very needful.

 

thanks in advance