Oauth Jira authentication client issue when requesting token with OAuthTutorialClient-1.0.jar

Jorge Amat March 27, 2018

I'm trying to authenticate my java application against the JIRA REST API using OAuth (1.0a as OAuth 2.0 is not supported).

For this purpose, I'm trying to complete first of all the guide provided by atlassian at:https://developer.atlassian.com/server/jira/platform/oauth/

However, I can´t move on from Step 2. Do the “OAuth dance”. When executing java -jar OAuthTutorialClient-1.0.jar requestToken I'm getting the following error output:

com.google.api.client.http.HttpResponseException: 400oauth_parameters_absent=oauth_consumer_key&oauth_problem=parameter_absent
        at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1070)        at com.google.api.client.auth.oauth.AbstractOAuthGetToken.execute(Abstrac        at com.atlassian.oauth.client.example.JiraOAuthClient.getAndAuthorizeTemp
        at com.atlassian.oauth.client.example.OAuthClient.handleGetRequestTokenAc
        at com.atlassian.oauth.client.example.OAuthClient.execute(OAuthClient.jav
        at com.atlassian.oauth.client.example.ClientMain.main(ClientMain.java:18)

It seems to me there is an issue with my private/public key despite I have followed every previous step showed in the guide. Moreover the error message doesn't provide any more details besides the above.

My config.properties file looks like this:

#Mon Mar 26 19:41:28 CEST 2018jira_home=https://jira.myserver.comconsumer_key=OauthKeyprivate_key=MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBANRno34rGDJ48PkMdVKH/48g2Gvjn4ACSmppXXtUZ59Mk6PO2OB/iF5Z3XS5yO9Dsyj1UzVR0TtWCUAHMYlSRNCvEhsG7g31snKh+bn6TbVYpzvDgKV7V64juWZkadC3tQcljwMBVSRTV5TBDLuyvqyl0NKqbyBdhtnJCqpK1rUPAgMBAAECgYBLs/yDdVyUcKKCQTx3g91D6BL6sRAiEa7wKkmVMUoVbreYRJrruMijyCez+JtzG4/5Yyaa9GQ8X7fASFARf27iw3qeHtcZyQjcCHzEg6vNd9jMOcr4aGh5dnNK0qVoEvVuIf38yw2Kdrhch++Xy4T/8qwFiuaaOabqhg73ZUiDYQJBAPR9OkremW4pySs2wMhxwigW0JOKnZUgGRjK1UHKqvqJjrherEo1MP0btZ1cQdvUyCa0Q8TCgZ9eR/DFy+pNQrkCQQDeZ7SulproyM8mqIb9B33sWN+YqIVJZN6jjOaZy+ZHBzQLHmv3TU7C0KB3v/9+WXKa/mT0Zxm1noSBx49PX/IHAkEA8GpYMRlVrPOgI0NzLWhX8U4GCp/LN8JZi3yhWlHt8fHkiz5lk49cvfhKjhQTmxVRQGYRIeHWzx1KBuSqEZup2QJBAKULHKA7DzYUXvV3NsVq292ajkOBO3gdrMJ9+1rCX17yT4K4zrI04m/b1llHV9hxlITEqDJemEuZGQgeCZGDx90CQQDL504bCmx3aXeNLQheVkzmJdyjaRfxrgycVSNgRPMeqR7fK2+taaOp9cDfYPTiu+y4RSFdigCJBd3PaT41DL5H

Anyway, My ultimate goal is to authenticate my java application against the JIRA REST API using OAuth, hence I need to know how to get the access token.

Could you please help on this?

3 answers

0 votes
fabiobarreto NA September 8, 2020

The message error from JIRA is very poor. It’s says “oauth_parameters_absent=oauth_consumer_key&oauth_problem=parameter_absent” for almost anything you configure wrong in the call. not just if forget to pass the consumer key.

Some problems that I came across and resulted in that error:
1- Wrong private key
2- Spaces in private key
3- Wrong consumer key
4- Wrong url
5- The public key configured in the application link and the private key sent doesn’t match

It’s very sad to see such a big API service of a giant organization have this basic issue of not specifying the exact error occurred.

0 votes
Rich Wilkins December 12, 2019

Has anyone found a solution?

@amritha jayadev

@Michał Karpiński 

@Jorge Amat 

@Shaun S 

We've searched all over and while there are numerous people asking the question, not one seems to have a solution.

0 votes
Shaun S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 12, 2018

Hi Jorge,

 

I'd like to confirm one detail about your config.properties file.  The spacing in your post implies that the text is all a single line.  Is that the case in that file? It should a single entry per line like the following:

#Mon Mar 26 19:41:28 CEST 2018
jira_home=https\://jira.myserver.com
consumer_key=OauthKey
private_key=MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBANRno34rGDJ48PkMdVKH/48g2Gvjn4ACSmppXXtUZ59Mk6PO2OB/iF5Z3XS5yO9Dsyj1UzVR0TtWCUAHMYlSRNCvEhsG7g31snKh+bn6TbVYpzvDgKV7V64juWZkadC3tQcljwMBVSRTV5TBDLuyvqyl0NKqbyBdhtnJCqpK1rUPAgMBAAECgYBLs/yDdVyUcKKCQTx3g91D6BL6sRAiEa7wKkmVMUoVbreYRJrruMijyCez+JtzG4/5Yyaa9GQ8X7fASFARf27iw3qeHtcZyQjcCHzEg6vNd9jMOcr4aGh5dnNK0qVoEvVuIf38yw2Kdrhch++Xy4T/8qwFiuaaOabqhg73ZUiDYQJBAPR9OkremW4pySs2wMhxwigW0JOKnZUgGRjK1UHKqvqJjrherEo1MP0btZ1cQdvUyCa0Q8TCgZ9eR/DFy+pNQrkCQQDeZ7SulproyM8mqIb9B33sWN+YqIVJZN6jjOaZy+ZHBzQLHmv3TU7C0KB3v/9+WXKa/mT0Zxm1noSBx49PX/IHAkEA8GpYMRlVrPOgI0NzLWhX8U4GCp/LN8JZi3yhWlHt8fHkiz5lk49cvfhKjhQTmxVRQGYRIeHWzx1KBuSqEZup2QJBAKULHKA7DzYUXvV3NsVq292ajkOBO3gdrMJ9+1rCX17yT4K4zrI04m/b1llHV9hxlITEqDJemEuZGQgeCZGDx90CQQDL504bCmx3aXeNLQheVkzmJdyjaRfxrgycVSNgRPMeqR7fK2+taaOp9cDfYPTiu+y4RSFdigCJBd3PaT41DL5H

The error seems to explain that a value for consumer_key isn't being passed, so an error in the config.properties file syntax might explain that.

Michał Karpiński August 29, 2018

We face the same issue with jira 7.8.2. I was debugging the sample Java Oauth Client from https://bitbucket.org/atlassian_tutorial/atlassian-oauth-examples?_ga=2.234605910.950587562.1535547425-1648527214.1524824718 and it seems that oauth_consumer_key is being passed. Any idea what could be an issue?

amritha jayadev April 2, 2019

Hi ,

I am facing the same issue: 'Invalid response 400: oauth_parameters_absent=oauth_consumer_key&oauth_problem=parameter_absent'.

Jira version is 7.9.x. I am running the python version of the same project. I copied the private key I generated to 'rsa.pem' file present at the root of this project.

Logs below:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pydev\pydevd.py", line 1664, in <module>
main()
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pydev\pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pydev\pydevd.py", line 1068, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:/atlassianlabs-atlassian-oauth-examples-dd0264cad043/python/app.py", line 71, in <module>
raise Exception("Invalid response %s: %s" % (resp['status'], content))
Exception: Invalid response 400: oauth_parameters_absent=oauth_consumer_key&oauth_problem=parameter_absent

Any help on how to proceed is much appreciated.

Thanks!

James Brown August 26, 2020

Hi Shaun,
I followed the directions to the T by copying and pasting the CLI commands, cloning the repository and updating the files as specified and have received the following error. What should everyones next step be?
java -jar OAuthTutorialClient-1.0.jar requestToken
Aug 26, 2020 3:37:56 PM org.apache.http.impl.client.DefaultRequestDirector handleResponse
WARNING: Authentication error: Unable to respond to any of these challenges: {oauth=WWW-Authenticate: OAuth realm="https%3A%2F%2Fcodetst.waters.com%2Fjira", oauth_problem="consumer_key_unknown"}
com.google.api.client.http.HttpResponseException: 401
oauth_problem=consumer_key_unknown
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1070)
at com.google.api.client.auth.oauth.AbstractOAuthGetToken.execute(AbstractOAuthGetToken.java:73)
at com.atlassian.oauth.client.example.JiraOAuthClient.getAndAuthorizeTemporaryToken(JiraOAuthClient.java:37)
at com.atlassian.oauth.client.example.OAuthClient.handleGetRequestTokenAction(OAuthClient.java:69)
at com.atlassian.oauth.client.example.OAuthClient.execute(OAuthClient.java:51)
at com.atlassian.oauth.client.example.ClientMain.main(ClientMain.java:18)

Suggest an answer

Log in or Sign up to answer