When attempting to authenticate with the REST API I receive an invalid signature error. I’m passing the below as my base string:
POST&https%3A%2F%2Fgnerbdev.atlassian.net%2Fplugins%2Fservlet%2Foauth%2Frequest-token&oauth_consumer_key%3D3MVG9KI2HHAq33RwCPH5bNzAHbOgfiicjJ6HjvVfNhGU8aWXGl6ps.vsEzobCPqRXuDcmeV2Baw%3D%3D%26oauth_nonce%3D7188823967346491475%26oauth_signature_method%3DRSA-SHA1%26oauth_timestamp%3D1492306511
And then signing it using a shared cert that I have set up in the application links section. Since I am getting a decrypted string back from JIRA I’m confident that I have configured my application link correctly. Below is what JIRA Returns:
18:35:11:202 USER_DEBUG
[30]|DEBUG|oauth_problem=signature_invalid
&oauth_signature=<redacted because apparently atlassian doesn’t want me to put this in the question>
&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%253D7188823967346491475%2526oauth_signature_method%253DRSA-SHA1%2526oauth_timestamp%253D1492306511
&oauth_signature_method=RSA-SHA1
This is my first time working with OAuth. I was able to get the REST API Working with basic authentication, I just want something more secure.
Update
I found this OAuth troubleshooting guide | Application Links Data Center and Server 9.0 | Atlassian Documentation a while back and at first I discounted it as it didn’t seem like it could be the cause.
I used requestb.in/vyqrg1vy?inspect (note this page will only be active for like 48 hours) and was able to determine that no referer was being passed. I set this manually in the header:
req.setHeader(‘Referer’,’ gnerb-dev-ed.my.salesforce.com/exec-anon’);
And the error still persisted. From what I can tell, the referer header is the primary way http determines the URI of the application making the request. Is this not correct? What other method would the server be expecting the URI to be provided?
Note:
I removed the HTTP from some of the url’s as the community automatically converted them to links and I can’t have that many links.