OAuth 1.0 A Invalid Signature when requesting request token (SalesForce/JIRA Integration) -
i've been trying darndest avoid asking question. i'm recieving invalid signature error when trying request request token jira within salesforce. response i'm getting is:
08:15:24:201 user_debug [30]|debug| oauth_problem=signature_invalid
&oauth_signature=raopabpznms7aduujn1poclcyhwp4uryyx4j%2f%2bdtkb1sd4l1jcccys3p3raa8p7377mwlsimbtkhfl62jaxr5lv30rndjvuslcsvl3h47cvinhgdttmwwgukqjxhomsslpvcccqd7qsrmiqnnjsjcwd9ykjei2cxncwmqhnceqawjdzn3rd%2fbbenpf3g97wqwhjx%2ftyehqgk35otu00fhtw%2bix025stn3iignbyanlmoimagwqajeqjopuvva7tr2oainysl9%2bhmykqtocb7a9sn5rrwuqe4jua6eovypgzjnsgz4pfeimzu0etwqqhsfdqwodnoq5equ8w%2bpjm8ua%3d%3d
&oauth_signature_base_string=post%26https%253a%252f%252fgnerbdev.atlassian.net%252fplugins%252fservlet%252foauth%252frequest-token%26oauth_consumer_key%253d3mvg9ki2hhaq33rwcph5bnzahbogfiicjj6hjvvfnhgu8awxgl6ps.vsezobcpqrxudcmev2baw%25253d%25253d%2526oauth_nonce%253d-6826921263934288296%2526oauth_signature_method%253drsa-sha1%2526oauth_timestamp%253d1492182924
&oauth_signature_method=rsa-sha1
the code i'm using try generate signature is:
// github oauth playground: https://github.com/jesperfj/sfdc-oauth-playground/blob/master/oauth/src/classes/oauth.cls // oauth bible: http://oauthbible.com/ // static values string consumerkey = '3mvg9ki2hhaq33rwcph5bnzahbogfiicjj6hjvvfnhgu8awxgl6ps.vsezobcpqrxudcmev2baw=='; string endpoint = 'https://gnerbdev.atlassian.net/plugins/servlet/oauth/request-token'; // params string callbackparam = '&oauth_callback=' + encodingutil.urlencode('https://localhost/', 'utf-8'); string consumerkeyparam = '&oauth_consumer_key=' + encodingutil.urlencode(consumerkey, 'utf-8'); string signaturemethodparam = '&oauth_signature_method=rsa-sha1'; string timestampparam = '&oauth_timestamp=' + string.valueof(datetime.now().gettime()/1000); string nonceparam = '&oauth_nonce=' + string.valueof(crypto.getrandomlong()); string versionparam = '&oauth_version=1.0'; string paramstring = consumerkeyparam + nonceparam + signaturemethodparam + timestampparam + versionparam + callbackparam; // basestring string basestring = 'post&' + encodingutil.urlencode(endpoint, 'utf-8') + paramstring; system.debug(basestring); blob sig = crypto.signwithcertificate('rsa-sha1', blob.valueof(basestring), 'selfsignedcert_26oct2015_184625'); string signature = encodingutil.urlencode(encodingutil.base64encode(sig), 'utf-8'); httprequest req = new httprequest(); http http = new http(); req.setendpoint(endpoint); req.setmethod('get'); req.setbody(paramstring + '&oauth_signature=' + signature); httpresponse res = http.send(req); system.debug(res.getbody());
note: yes understand shouldn't sharing of information these personal test orgs contain nothing important , i'm not providing ssl used. you'll notice comments @ top of code containing few urls favorite resources have gotten me far. these not resources i've used, useful ones.
Comments
Post a Comment