Jira cloud REST API - Login endpoint is always giving me 401 error

awajieh January 19, 2020

Hi Team,

 

I am using JIRA cloud system. and i want to use the public REST api in due automation furthers.

 

I am trying to login using the following endpoint:

POST https://awajieh.atlassian.net/rest/auth/1/session

BODY {"username":"my email", "password":"mypassword"}

 

Response

{    "errorMessages": [        "Login failed"    ],    "errors": {}}

 

What is the issue since i am login on web portal using the same information and i am able to login.

 

please verify

2 answers

2 votes
Veera
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 19, 2020

Hi @awajieh 

Using passwords with Jira REST API basic authentication has been deprecated. You need to create API token and use it in the REST call.

 

Below document explains how to create and use API token for authentication.

https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/

1 vote
edwin
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.
January 19, 2020
edwin
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.
January 19, 2020

This is before I saw @Veera's answer

Like Veera likes this
Maycon Belfort October 2, 2020

Hi @edwin ,

 

So... How to do a HTTP authentication with Rest API?

What headers option should I include?

Content-Type: application/json;charset=UTF-8

Authorization: ???????

 

Thank you

Like edwin likes this
edwin
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 3, 2020

Hi @Maycon Belfort ,

Please take a look at this documentation for more information.

Basic authentication 

For the username/password example, it would be best to pass in just the username and you'll be prompted to input a password. 

Like Maycon Belfort likes this

Suggest an answer

Log in or Sign up to answer