Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

REST API not authenticating

Leoš MAREK October 14, 2022

Hello,

as per Basic username/pass authentication was deprecated, I have used this guide and tried with API token.

https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/

However, the curl call in example ends with a message:

HTTP/1.1 401 Unauthorized
< Date: Fri, 14 Oct 2022 12:48:26 GMT
< Content-Type: text/plain
< Server: globaledge-envoy
< X-Envoy-Upstream-Service-Time: 1
< Expect-Ct: report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/atlassian-proxy", max-age=86400
< Strict-Transport-Security: max-age=63072000; preload
< X-Content-Type-Options: nosniff
< X-Xss-Protection: 1; mode=block
< Atl-Traceid: 32a85b1cbe7d6957
< Report-To: {"endpoints": [{"url": "https://dz8aopenkvv6s.cloudfront.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}
< Nel: {"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
<
Basic authentication with passwords is deprecated. For more information, see: https://developer.atlassian.com/cloud/confluence/deprecation-notice-basic-auth/

 

So how are we supposed to use the API authentication?

Thanks

2 answers

1 accepted

1 vote
Answer accepted
Prince Nyeche
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 14, 2022

What headers are you passing with your curl command? You can authenticate with the below method on the cloud, either by using basic auth that's base64 encoded

curl --headers 'Authorization: Basic anZYxxxxx'

OR

Email + API token combination

curl --user 'email@example.com:APITOKEN'

Passing the correct headers, request method etc above prior to running the curl command 

Leoš MAREK October 14, 2022

Hi,

what you mention is exactly what Im doing.

curl -v https://SITE.atlassian.net/rest/api/latest/project --user MYEMAIL:MYTOKEN

or

curl -D- -X GET -H "Authorization: Basic MYSTRING" ...

Always end up with the message above.

0 votes
Leoš MAREK October 17, 2022

my mistake, I have used wrong API token :(

thanks

Bo Lasater November 19, 2022

Leos, what turned out to be the "right" token? Is it the one you got from the API token management screen in your profile?

Leoš MAREK December 21, 2022

Hi,

sorry for late response. I found out there are two screens where you can configure API tokens. The first is in Administration menu and the second is in your account settings->security.

The second one was the right one to use.

Rg

Like Vinod Kotiya likes this
Vinod Kotiya December 21, 2023

I am really pissed off from atlassian team. I wasted 4 hours to figure out why my api is not working. Guess what because atlassian team thinks API to be created at two different places and don't guide the users which one to use. Pathetic.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events