How to authenticate to Jira REST API with Access token

taiebaf October 21, 2019

I followed the tutorial to get the access token, when i try with the command with Java it's working pretty well as soon as i want to check if the access token is working with a simple CURL command or in REST CLIENT, it always returns me not authenticated  

2 answers

3 votes
DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 21, 2019

@taiebaf

Can you share details of curl command you are using?

Here is sample that you can use to verify if things are working.

curl --request GET \
--url 'https://<SITE_NAME>.atlassian.net/rest/api/3/issue/<ISSUE_KEY>' \
--user '<EMAIL>:<API_TOKEN>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

 

Please replace, <SITE_NAME>, <ISSUE_KEY>, <EMAIL>, <API_TOKEN> with appropriate values. 

taiebaf October 21, 2019

@DPKJ 

 

 

I followed this tutorial https://developer.atlassian.com/cloud/jira/service-desk/jira-rest-api-oauth-authentication/ to generate an access_token, it's working pretty well, i can perform my call with


java -jar OAuthTutorialClient-1.0.jar request https://jiratest.jira.net/rest/api/2/user?username=me\

but when i try with curl or postman

I always get : Authenticated_Failed.

 

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 21, 2019

@taiebafYou are mistaking oAuth Token with API Access Token. They are two different things.

Jira cloud provide two ways to login for API,

  • oAuth
  • Basic Auth

For CURL and Postman you need to basic authentication. Here are links,

Using Basic-authentication - https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-basic-authentication/

Generating API token for basic-authentication - https://confluence.atlassian.com/cloud/api-tokens-938839638.html

 

Please follow these two guides, and get back. Hopefully your issue will be resolved.

Like # people like this
Fahad Siddiqui
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 22, 2019

I am adding one new issue related to access request.

Once the request is been raised.

1. user Line manger will approve.

Now i want to add one more approve.

I am adding two fields 

Filed Name:  Type

System Name: Select List (single choice)

Owner Name: Select List (single choice)

 

Now i want one the system name is selected the owner name must display automatically, also it should go to same owner for approval.

Can anyone assist?

0 votes
Chao Wang
Contributor
November 10, 2021

Is that possible to use "Bearer Authentication" with PAT in jira-rest-java-client  ?

Ishani
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 20, 2022

Suggest an answer

Log in or Sign up to answer