# Unable to authenticate v2 API calls

**URL:** <https://discuss.circleci.com/t/unable-to-authenticate-v2-api-calls/46338>\
**Category:** API\
**Tags:** api\
**Created:** [December 14, 2022, 3:31pm UTC](https://discuss.circleci.com/t/unable-to-authenticate-v2-api-calls/46338 "2022-12-14T15:31:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jp-itv](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/jp-itv/32/31769_2.png) [@jp-itv](https://discuss.circleci.com/u/jp-itv)\
**Post date:** [December 14, 2022, 3:31pm UTC](https://discuss.circleci.com/t/unable-to-authenticate-v2-api-calls/46338/1 "2022-12-14T15:31:22Z")

</div>

I’m making a small .Net application which needs to be able to download build artifacts from the CircleCI API. Everything worked fine locally but after deploying to a Citrix machine the authentication doesn’t seem to be working. I’ve checked and everything appears to be the same in both scenarios.

See below for an example of the code used.

```auto
public T Read()
        {
            using (var wc = new WebClient())
            {
                wc.Headers.Add(HttpRequestHeader.ContentType, "application/json");
                wc.Headers.Add(HttpRequestHeader.Accept, "application/json");
                wc.Headers.Add("circle-token", "XXXXXXXXXXXXXXXXXXXXXXXXXXX");
                var json = wc.DownloadString("https://circleci.com/api/v2/me");
                return JsonConvert.DeserializeObject<T>(json, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
            }
        }

```

When pasting the following url directly into Chrome on the Citrix box I get the response “You must log in first.”

[https://circleci.com/api/v2/me?Circle-Token=XXXXXXXXXXXXXXXXXXXXXXX](https://circleci.com/api/v2/me?Circle-Token=XXXXXXXXXXXXXXXXXXXXXXX)

As far as I’m aware the only authentication needed is the token? I’ve definitely created a personal token (not a project one) and all of the calls I’ve been making from my local machine have worked fine with just that. Is there something extra that I’m missing?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![rit1010](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/rit1010/32/34738_2.png) [@rit1010](https://discuss.circleci.com/u/rit1010)\
**Post date:** [December 15, 2022, 2:27pm UTC](https://discuss.circleci.com/t/unable-to-authenticate-v2-api-calls/46338/2 "2022-12-15T14:27:04Z")

</div>

The token “Circle-Token” is placed in the header, so trying a URL directly with the token in the URL will not work. Within the docs for self-hosted runners it is also stated that the token can be used in a URL by assigning it to a ‘username’ and passing a blank ‘password’.

```
https://circleci.com/docs/runner-api/#circle-token-personal-authentication

```

Another poorly documented feature is the fact that the token is base64 encoded

```
https://support.circleci.com/hc/en-us/articles/360052405651-Utilizing-Basic-Authorization-in-CircleCI-API-Calls

```

The problem is that this statement provides no real context
