How to deal with "Failed to parse Connect Session Auth Token"?

Sidrit Reka June 25, 2018

I am trying to complete authentication flow with Jira. After following the steps in this link:
https://developer.atlassian.com/server/jira/platform/oauth/ , I am able to get the access token. The requests I do are:
1)BaseUrl/plugins/servlet/oauth/request-token

2)After that I am prompted to the login page in my browser and I successfully grant access.

The url is BaseUrl/plugins/servlet/oauth/authorize?oauth_token={token in the first step}

3)And I get the access token with this request:

BaseUrl/plugins/servlet/oauth/access-token

Finally I try to make a request to get my issues and I pass the access token to the authorization header like this:
Authorization: Bearer {accesstoken}

And I get 403 error code with the message "{"error": "Failed to parse Connect Session Auth Token"}"
Can someone guide me to a solution for this?

1 answer

1 vote
Valery Lebedz July 26, 2018

Have you found an answer to this issue? 

Sidrit Reka July 27, 2018

Hi Valery,

Apparently the Jira documentation about this was wrong. We shouldn't use Bearer authentication, but instead try to authenticate with OAuth1 standart.

Like # people like this
Deepak Kumar November 2, 2018

@Sidrit Reka Can you please elaborate how to authenticate with OAuth1 standard?

Like # people like this
Admin April 18, 2019

@Deepak Kumar  In Python;

You can use HTTPBasicAuth to get access with JIRA API;

Sample code;

# Call JIRA API with HTTPBasicAuth
import json
import requests
from requests.auth import HTTPBasicAuth

JIRA_EMAIL = "****"
JIRA_TOKEN = "****"
BASE_URL = "https://****.atlassian.net"
API_URL = "/rest/api/3/serverInfo"

API_URL = BASE_URL+API_URL

BASIC_AUTH = HTTPBasicAuth(JIRA_EMAIL, JIRA_TOKEN)
HEADERS = {'Content-Type' : 'application/json;charset=iso-8859-1'}

response = requests.get(
API_URL,
headers=HEADERS,
auth=BASIC_AUTH
)

print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

 

Thanks :)

Like # people like this
Chakresh Tiwari March 31, 2020

Hi @Deepak Kumar  

If I am trying the same solution in java then if our app is installed in some other person Jira account and if he is calling then how to pass that token dynamically. Because this is fixed for a particular user.

Any Suggestion. How to do that in java.

Suggest an answer

Log in or Sign up to answer