Forums

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

Unable to login Jira through Java with user credentials.

Amruta Harale
March 6, 2023

Hello Team,

I am using Jira 8.21 Data center.

In the java program, With the help of Jira API, I try to use the POST method and login into Jira using a username and password. At the same time, I wanted to pass JSON data.

I am not able to do both the things same time. Please Help. 

 

1 answer

0 votes
Charlie Misonne
Community Champion
March 6, 2023

Hello,

Can you post an example of your HTTP request? And does it work with anbother tool like curl, powershell, postman, ...? Or do you only have the issue in java.

For the authorization: make sure you use a personal access token with the Bearer authorization header. An example can be found on this page: Using Personal Access Tokens

Here's a copy:

curl -H "Authorization: Bearer <yourToken>" https://{baseUrlOfYourInstance}/rest/api/content

kind regards,

Charlie

Amruta Harale
March 9, 2023

Thanks for your response. I am using postman for posting requests.

Based on the information provided by you just wanted to know what do we need to pass against "token name" in the JSON body.

{{baseUrlOfYourInstance}}/rest/pat/latest/tokens
{
    "name": "tokenName",
    "expirationDuration": 90
}

 Kindly provide an example using postman similar to the one you posted using CURL

Amruta Harale
March 30, 2023

Hello Team ,

Please help..

Suggest an answer

Log in or Sign up to answer