Jira oauth error signature length not correct

Daniel Bleser May 31, 2017

Hey!

Currently iam developing a little Jira notification tool in C# for Jira events that i can configure in my tool. To get the information from jira i contact the rest api.

In the first step i implemented basic authentication. so i have to send the users credentials als base64 with each request to rest api. Thats working perfectly.

To make it a bit more safe i would like to implement oauth.

I have never used oauth before and i have a little problem with constructing the request.

In first step i want to ask for a request token.

So i created a basestring with the encodedurl and the oauthparameters.

Like this:

POST&https%3A%2F%2Fdevjira.ad.hygi.de%2Fplugins%2Fservlet%2Foauth%2Frequest-token%26oauth_consumer_key%3Dhardcodedtestkey%26oauth_signature_method%3DRSA-SHA1%26oauth_timestamp%3D1496215211%26oauth_nonce%3DNjM2MzE4MTkyMTE2MjY0ODMw%26oauth_callback%3Doob

Here iam using consumer key, signature method, timestamp, nonce and callback, but i also tried combos without callback and with oauth_version.

With this example i created rsa-sha1 signature using the bouncycastle library.
My authorization header looks like this: (i used public and private key from the example you can find here
https://bitbucket.org/atlassian_tutorial/atlassian-oauth-examples)
Now my authorization header looks like this:

{
Authorization: OAuth oauth_consumer_key="hardcodedtestkey", oauth_signature_method="RSA-SHA1", oauth_timestamp="1496215211", oauth_nonce="NjM2MzE4MTkyMTE2MjY0ODMw", oauth_callback="oob", oauth_signature="HtlcgkFjR24obsW6yUAV9czhUelq1/htBaJjxjeNEKx1H+I6aYOYXgthHBt8/NDtqWHi+KHoa1nV7raWoVMMGz6kwSqZ3q+66ULN1YBRmxHRiXwsDllqZOkgjwG3bbxjtWBpmWrouXbsUNk/sQwZ/XG7h0oljcLFltwAzTsHp6E="

}

When calling the request token url i get error 500 and logs say "signature length not correct" got 127 expecting 128.

Do you have any idea what iam missing or doing wrong?
Iam right with the oauth-parameter for version being optional? tried with it but still getting same error.
i appreciate your help!

0 answers

Suggest an answer

Log in or Sign up to answer