When trying to access JIRA Issues via JIRA REST API V2 from Salesforce always returns 401 error page for Basic authentication. But this basic authentication is working from some other REST client test tools. I just created a trial version JIRA site to test this. Can someone help me what could be the issue.
Thanks.
Hi Karthik,
I understand that you're seeing only 401 HTTP error codes return from Jira Cloud REST API. Most of the REST API endpoints require authentication to work properly. In cases where the authentication is inadequate or incorrect, you can see these 401 error codes.
In the specific case of Jira Cloud and using the Basic Authentication method, Atlassian has recently deprecated the ability to use plaintext passwords with basic auth. You can read the Deprecation notice for more details.
I'm afraid I don't know the exact details of how this salesforce integration is setup to work in your instance. If it just has a username and password fields to fill out, I would expect this to fail with Jira Cloud moving forward. There are new details of how you can still use basic auth with Jira Cloud, but there are different headers that have to be passed when making the call, you need to generate a REST API token, and then you need to build a string and encode that string as described in the Basic Authentication documentation.
Are you using a plugin in Jira in order to do this REST API call? Or is this an integration directly from the Salesforce app/site? Just curious so we can best guide you on ways to work past this.
Andy
Hi,
If our system is using Basic authentication to connect to Jira REST API, is there any workaround that we can still make it work for certain period of time or now there is no way to make basic authentication with plain text work?
Regards,
Hardik
@Hardik Jethava Basic auth is still available. But you can no longer use a plaintext password with Atlassian Cloud REST API authentication attempts.
The work-around using basic auth is to first create an API token, then follow the steps in Basic auth for REST APIs. It explains that there are some different steps you would need to take in order to make this work with an API token vs using a password. The method I prefer when doing this is listed there as:
Supplying basic auth headers If you need to, you may construct and send basic auth headers yourself. To do this you need to perform the following steps: Generate an API token for Jira using your Atlassian Account: https://id.atlassian.com/manage/api-tokens. Build a string of the form useremail:api_token. BASE64 encode the string. Supply an Authorization header with content Basic followed by the encoded string. For example, the string fred:fred encodes to ZnJlZDpmcmVk in base64, so you would make the request as follows: curl -D- \ -X GET \ -H "Authorization: Basic ZnJlZDpmcmVk" \ -H "Content-Type: application/json" \ "<a href="https://your-domain.atlassian.net/rest/api/2/issue/QA-31" target="_blank" rel="nofollow noopener noreferrer">https://your-domain.atlassian.net/rest/api/2/issue/QA-31</a>"
If you need to, you may construct and send basic auth headers yourself. To do this you need to perform the following steps:
useremail:api_token
Authorization
Basic
fred:fred
ZnJlZDpmcmVk
curl -D- \
-X GET \
-H "Authorization: Basic ZnJlZDpmcmVk" \
-H "Content-Type: application/json" \
"<a href="https://your-domain.atlassian.net/rest/api/2/issue/QA-31" target="_blank" rel="nofollow noopener noreferrer">https://your-domain.atlassian.net/rest/api/2/issue/QA-31</a>"
I hope this helps.
Hello Andy,
I have created the api as mentioned in the steps then encoded it using base64 . Passed emailid:apikey.
Authorization : Basic <generated key>
Content-Type : application/json
Then also it is not working. Am i missing any steps
Hi Team,
I have below details with me:-
1.API Token
2.Correct URI
3.Correct User Name
4.Rest API :- rest/api/3/project(to see all the projects)
Used Authorization as Basic Auth and username as email address and password as the API token key.
I hit this api via post man and i am getting error as :-
Basic authentication with passwords is deprecated. For more information, see: https://confluence.atlassian.com/cloud/deprecation-of-basic-authentication-with-passwords-for-jira-and-confluence-apis-972355348.html
Please suggest what am i missing here.
kamran
Don't use the username/password fields here directly. At one point in the past I know that you could use the API Token just like a password, but the way you're using that token now is just like a password. Jira Cloud REST API doesn't support using any password type fields here.
Instead follow the steps in Basic auth for REST APIs. It is going to have to build a string of
EmailAddress:ApiToken
And then base64 encode that string. Once you have that encoded string, the suggestion is to use an authorization header and pass that encoded string in that as a means to include authentication in the request. This method works.
But you can't just substitute an API token for the previous way passwords worked here.
It looks like you're new here. Sign in or register to get started.