Pack: Jira Token issue

(LuisN) #1

I know what the 1st thing i will receive, did you read the instructions =) yes 10 times

Still getting the following, and I follow all the steps. the generator still gives an error but outputs the URL and auth key / secret just fine. config file has the same values givem, i approved the access in jira and registered all configs in st2. still no go

STEP 1: GET REQUEST TOKEN
  oauth_token=REMOVED
  oauth_token_secret=REMOVED


STEP2: AUTHORIZATION
  Visit to the following URL to provide authorization:
  https://jira-staging.server.com/plugins/servlet/oauth/authorize?oauth_token=REMOVED


Traceback (most recent call last):
  File "generate_access_token.py", line 45, in <module>
    while raw_input("Press any key to continue..."):
NameError: name 'raw_input' is not defined
WARNING:root:Got recoverable error from GET https://jira-staging.server.com/rest/api/2/serverInfo, will retry [1/3] in 3.91456855975s. Err: 401 Unauthorized
WARNING:root:Got recoverable error from GET https://jira-staging.server.com/rest/api/2/serverInfo, will retry [2/3] in 16.8720036128s. Err: 401 Unauthorized
WARNING:root:Got recoverable error from GET https://jira-staging.server.com/rest/api/2/serverInfo, will retry [3/3] in 24.4791964296s. Err: 401 Unauthorized
Traceback (most recent call last):
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/python_runner/python_action_wrapper.py", line 325, in <module>
    obj.run()
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/python_runner/python_action_wrapper.py", line 183, in run
    action = self._get_action_instance()
  File "/opt/stackstorm/st2/local/lib/python2.7/site-packages/python_runner/python_action_wrapper.py", line 252, in _get_action_instance
    action_service=action_service)
  File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/runners/utils.py", line 143, in get_action_class_instance
    action_instance = action_cls(**kwargs)
  File "/opt/stackstorm/packs/jira/actions/lib/base.py", line 17, in __init__
    self._client = self._get_client()
  File "/opt/stackstorm/packs/jira/actions/lib/base.py", line 37, in _get_client
    client = JIRA(options=options, oauth=oauth_creds)
  File "/opt/stackstorm/virtualenvs/jira/lib/python2.7/site-packages/jira/client.py", line 472, in __init__
    si = self.server_info()
  File "/opt/stackstorm/virtualenvs/jira/lib/python2.7/site-packages/jira/client.py", line 2133, in server_info
    j = self._get_json('serverInfo')
  File "/opt/stackstorm/virtualenvs/jira/lib/python2.7/site-packages/jira/client.py", line 2549, in _get_json
    r = self._session.get(url, params=params)
  File "/opt/stackstorm/virtualenvs/jira/lib/python2.7/site-packages/jira/resilientsession.py", line 151, in get
    return self.__verb('GET', url, **kwargs)
  File "/opt/stackstorm/virtualenvs/jira/lib/python2.7/site-packages/jira/resilientsession.py", line 147, in __verb
    raise_on_error(response, verb=verb, **kwargs)
  File "/opt/stackstorm/virtualenvs/jira/lib/python2.7/site-packages/jira/resilientsession.py", line 57, in raise_on_error
    r.status_code, error, r.url, request=request, response=r, **kwargs)
jira.exceptions.JIRAError: JiraError HTTP 401 url: https://jira-staging.server.com/rest/api/2/serverInfo
	text: oauth_problem=token_rejected
	
	response headers = {'Content-Length': '28', 'Server': 'Apache-Coyote/1.1', 'Connection': 'close', 'Date': 'Mon, 11 Mar 2019 22:01:52 GMT', 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', 'WWW-Authenticate': 'OAuth realm="https%3A%2F%2Fjira-staging.server.com", OAuth realm="https%3A%2F%2Fjira-staging.server.com", oauth_problem="token_rejected"'}
	response text = oauth_problem=token_rejected
(Lindsay Hill) #2

Maybe try basic auth?

(LuisN) #3

Want to stay away from username / pass. so if the pack was written for oauth1, atlasian 7.X is using oauth2 im pretty sure this is why im getting the error. any plans to update?

(Lindsay Hill) #4

Pack updates are user-driven. Basically someone has an itch, they scratch it. I haven’t heard of anyone working on adding oauth2 support, but it would most likely show up as a finished PR, rather than work in progress.

You could start a PR at github.com/StackStorm-Exchange/stackstorm-jira, or failing that, write up a detailed issue explaining what’s going on, and what’s needed. If it’s related to specific Jira versions, include that. You could also update the README to advise that oauth1 won’t work with Jira 7.x (or whatever the relevant versions are)

(Cygnetix) #5

Are you sure Jira supports OAuth2? That’d be awesome if it does but I haven’t seen anything to suggest that’s the case.

Here’s the feature request to have OAuth2 added. Hopefully support does come soon: https://jira.atlassian.com/plugins/servlet/mobile#issue/JRA-43171