Rest API not working with Basic auth

Hello,

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

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
< Strict-Transport-Security: max-age=63072000; preload
< X-Content-Type-Options: nosniff
< X-Xss-Protection: 1; mode=block
< Atl-Traceid: 32a85b1cbe7d6957
< 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: …://developer.atlassian.com/cloud/confluence/deprecation-notice-basic-auth/

here is the syntax:
curl -v MYSITEURL --user MYEMAIL:MYTOKEN

or

curl -D- -X GET -H “Authorization: Basic MYSTRING” …

But no success at all. Any idea what I do wrong?

Thanks

Hey! I tried like as below:

curl --request GET \ 
  --url 'https://my-site.atlassian.net/rest/api/...your-required' \
  --user 'myemail@yahoo.com:hhjiieAfrzquLxkpKgcU58F7' \   
  --header 'Accept: application/json'

That worked for me. Or you can do the same thing as you did.

curl --request GET \ 
  --url 'https://my-site.atlassian.net/rest/api/...' \
  --header 'Authorization: Basic MYSTRING' \   
  --header 'Accept: application/json'

Thanks.

Hello,
thanks for your answer. Pls see the image below. I do compeltely the same you did.

Welcome to the Atlassian developer community @LeoMAREK,

As @asd confirmed, the problem isn’t your curl syntax. But what can be confusing is that all auth errors with basic auth pretty much respond the same way that passwords are deprecated. For example, when I use my correct username (my email address) and a purposefully bad API token (like abc123), then I get that error message. My advice is to revoke that API token and to create a new one in the API tokens section of your user profile. Perhaps there was a copy/paste error when you generated the first one?

As in most cases, the issue was between the chair and keyboard… I was creating API token in admin section, not in my ID… :frowning:
Thanks for support

1 Like