Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to pull data using token from jira rest api in java

FAsmani September 20, 2021

I want to pull data from jira using token (NOT USING username and pass)

1 answer

1 accepted

0 votes
Answer accepted
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 22, 2021

Hello @FAsmani ,

Thanks for reaching out and the following document details how to create and manages API tokens:

Regards,
Earl

FAsmani September 22, 2021

Thank you @Earl McCutcheon for reply. Currently, I am working on https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/

But I am stuck on access token. I am not able to get the access token. I am getting "not found" in the result. If you please be able to help me with this, I would really appreciate it.

Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 22, 2021

Hello @FAsmani ,

Thanks for the clarification. 

It sounds like the app password has either not been created in Bitbucket yet or has expired/revoked and cannot be found.

You can create a new app token by going to Settings > personal settings > App Password.  and select the "create app password" option.

A shortcut to the page via the following link:

Regards,
Earl

FAsmani September 22, 2021

Hello @Earl McCutcheon ,

I have created an app in this link where I have client id and secret key too. 

https://developer.atlassian.com/console/myapps/

I am confused that do I need to create account on bitbucket?

FAsmani September 22, 2021

Hello @Earl McCutcheon

 

Do I need to log in into Jira Admin account to grant access?

Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 22, 2021

Hello @FAsmani ,  

A Big apology from me, I 100% sent you the incorrect information as I was working with two threads relating to oAuth and I sent you the bitbucket detail I meant to post to the other thread in error.

For a Jira app following the detail in the Oauth doc you mentioned:

It sounds like you have completed step one to obtain your authorization code, and are currently at step 2 attempting to exchange the auth code for the access token:

with the call:

curl --request POST \ --url 'https://auth.atlassian.com/oauth/token' \ --header 'Content-Type: application/json' \ --data '{"grant_type": "authorization_code","client_id": "YOUR_CLIENT_ID","client_secret": "YOUR_CLIENT_SECRET","code": "YOUR_AUTHORIZATION_CODE","redirect_uri": "https://YOUR_APP_CALLBACK_URL"}'

The majority of the setup occurs in the Developer Console at the following link:

The parameters that need to be entered can be found in the console at the noted locations below as covered in the doc:

  • client_id: (required) Set this to the Client ID for your app. Find this in Settings for your app in the developer console.
  • client_secret: (required) Set this to the Secret for your app. Find this in Settings for your app in the developer console.
  • code: (required) Set this to the authorization code received from the initial authorize call (described above).
  • redirect_uri: (required) Set this to the callback URL configured for your app in the developer console.

There is most likely something missing in the values or possible typo, like trailing slashes in the callback URL are common pain points here, Check this out and what was the full error you got when you initiate the call?

Regards,
Earl

FAsmani September 24, 2021

Hello @Earl McCutcheon

I want to integrate JIRA OAuth 2.0 (3LO) in java. So I was wondering if you please help me by suggesting reference documentation from where I can follow the steps, it would greatly helpful to me.

 

 

Thanks,

Femina Asmani

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events