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?
Hi Valery,
Apparently the Jira documentation about this was wrong. We shouldn't use Bearer authentication, but instead try to authenticate with OAuth1 standart.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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 :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.