Unable to authenticate v2 API calls

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.

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.”


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.

1 Like

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’.


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


The problem is that this statement provides no real context

1 Like