# Basic Authentication on Confluence Cloud REST API not working

**URL:** <https://community.developer.atlassian.com/t/basic-authentication-on-confluence-cloud-rest-api-not-working/16408>\
**Category:** Confluence Cloud\
**Created:** [March 22, 2018, 10:54pm UTC](https://community.developer.atlassian.com/t/basic-authentication-on-confluence-cloud-rest-api-not-working/16408 "2018-03-22T22:54:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff3](https://avatars.discourse-cdn.com/v4/letter/j/97f17d/32.png) [@jeff3](https://community.developer.atlassian.com/u/jeff3)\
**Post date:** [March 22, 2018, 10:54pm UTC](https://community.developer.atlassian.com/t/basic-authentication-on-confluence-cloud-rest-api-not-working/16408/1 "2018-03-22T22:54:27Z")

</div>

I’m trying to use the Basic Auth REST API for Confluence cloud documented here:  
[https://developer.atlassian.com/cloud/confluence/rest/](https://developer.atlassian.com/cloud/confluence/rest/)

Also my username in Confluence is “Admin”, will this cause problems?

However, I’m unable to authenticate as myself when I issue this request:

```auto
curl -X GET \
   --user '<my-email-address>:<my-api-token>' \
   -H 'Cache-Control: no-cache' \
   -H 'Accept: application/json' \
   -H "Content-Type: application/json" \
   "https://<my-domain>.atlassian.net/wiki/rest/api/user/current"

```

This is the response I get (verbose from curl):

```auto
> GET /wiki/rest/api/user/current HTTP/2
> Host: <domain>.atlassian.net
> Authorization: Basic <base64 string>
> User-Agent: curl/7.54.0
> Cache-Control: no-cache
> Accept: application/json
> Content-Type: application/json
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 401
< server: Atlassian Proxy/0.1.205
< vary: Accept
< www-authenticate: OAuth realm="https%3A%2F%2F<domain>.atlassian.net%2Fwiki"
< cache-control: no-cache, must-revalidate
< content-type: application/json
< strict-transport-security: max-age=315360000; includeSubDomains; preload
< date: Thu, 22 Mar 2018 22:40:54 GMT
< expires: Thu, 01 Jan 1970 00:00:00 GMT
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
* Connection #0 to host <domain>.atlassian.net left intact
{"message":"Request rejected because issuer is either not authorized or not authorized to impersonate","status-code":401}

```

My Atlassian ID is linked to my Google account and has two factor auth turned on. I’m not sure if that matters here.

Interestingly enough, this curl request works (note that it’s using the Authentication header, not Authorization). However, it Authenticates me as an anonymous user which is not what I would expect given that I’ve sent in my username and API token in the base64 encoded string.

```auto
curl -v -X GET \
   -H 'Authentication: Basic <base64 encoded credentials>' \
   -H 'Cache-Control: no-cache' \
   -H 'Accept: application/json' \
   -H "Content-Type: application/json" \
   "https://<domain>.atlassian.net/wiki/rest/api/user/current"

> GET /wiki/rest/api/user/current HTTP/2
> Host: <domain>.atlassian.net
> User-Agent: curl/7.54.0
> Authentication: Basic <base64 encoded string>
> Cache-Control: no-cache
> Accept: application/json
> Content-Type: application/json
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 200
< server: Atlassian Proxy/0.1.205
< vary: Accept-Encoding
< cache-control: no-cache, must-revalidate
< content-type: application/json
< strict-transport-security: max-age=315360000; includeSubDomains; preload
< date: Thu, 22 Mar 2018 22:46:39 GMT
< expires: Thu, 01 Jan 1970 00:00:00 GMT
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
<
* Connection #0 to host <domain>.atlassian.net left intact
{"type":"anonymous","profilePicture":{"path":"/wiki/s/<some path>/anonymous.png","width":48,"height":48,"isDefault":true},"displayName":"Anonymous","_expandable":{"operations":""},"_links":{"base":"https://<domain>.atlassian.net/wiki","context":"/wiki"}}

```

---

<div class="post-metadata">

**Author:** ![acalantog](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/acalantog/32/37988_2.png) [@acalantog](https://community.developer.atlassian.com/u/acalantog)\
**Post date:** [March 23, 2018, 6:57am UTC](https://community.developer.atlassian.com/t/basic-authentication-on-confluence-cloud-rest-api-not-working/16408/2 "2018-03-23T06:57:02Z")

</div>

Hi @jeff3,

“admin” as username should not cause you a problem. However, in your curl request:

> [@jeff3](#):
>
> curl -X GET   
> –user ‘\<my-email-address\>:\<my-api-token\>’   
> -H ‘Cache-Control: no-cache’   
> -H ‘Accept: application/json’   
> -H “Content-Type: application/json”   
> “https://\<my-domain\>.atlassian.net/wiki/rest/api/user/current”

are you using your email address and your api token in the `--user` argument? I’ve tried now and was able to get a response.

Cheers,  
Anne Calantog

---

<div class="post-metadata">

**Author:** ![huy](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@huy](https://community.developer.atlassian.com/u/huy)\
**Post date:** [July 16, 2018, 9:49am UTC](https://community.developer.atlassian.com/t/basic-authentication-on-confluence-cloud-rest-api-not-working/16408/3 "2018-07-16T09:49:41Z")

</div>

I’m facing the exact same problem:

```auto
curl \
    --user <my_email>:<my_api_token> \ (1s 17ms)
    --header 'Accept: application/json' \
    --url 'https://<my_site>.atlassian.net/wiki/rest/api/content'

```

Yields a 401

```auto
{"message":"Request rejected because issuer is either not authorized or not authorized to impersonate","status-code":401}⏎

```

My Atlassian ID is also a linked Google account.

Is there a configuration somewhere that disables Confluence REST API?

---

<div class="post-metadata">

**Author:** ![acalantog](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/acalantog/32/37988_2.png) [@acalantog](https://community.developer.atlassian.com/u/acalantog)\
**Post date:** [July 20, 2018, 6:45am UTC](https://community.developer.atlassian.com/t/basic-authentication-on-confluence-cloud-rest-api-not-working/16408/4 "2018-07-20T06:45:19Z")

</div>

Hi @huy,

Not that I’m aware of. Your command is correct and that should work for you as is mine. I tested now and I got a response from it.

If you’re currently logged in your your instance via browser, can you try navigating to: https://.atlassian.net/wiki/rest/api/content and see what happens?

Cheers,  
Anne Calantog

---

<div class="post-metadata">

**Author:** ![HlneLejeune](https://avatars.discourse-cdn.com/v4/letter/h/3be4f8/32.png) [@HlneLejeune](https://community.developer.atlassian.com/u/HlneLejeune)\
**Post date:** [April 4, 2020, 8:20pm UTC](https://community.developer.atlassian.com/t/basic-authentication-on-confluence-cloud-rest-api-not-working/16408/5 "2020-04-04T20:20:13Z")

</div>

Hi @huy, did you found out about Rest Api with Google?  
I tried curl like so because npm start on my project thrown not authorized to impersonate as well
