# AuthenticationError with Elastic Cloud

**URL:** <https://discuss.elastic.co/t/authenticationerror-with-elastic-cloud/43910>\
**Category:** Kibana\
**Created:** [March 9, 2016, 2:52pm UTC](https://discuss.elastic.co/t/authenticationerror-with-elastic-cloud/43910 "2016-03-09T14:52:28Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![tlv324](https://avatars.discourse-cdn.com/v4/letter/t/46a35a/32.png) [@tlv324](https://discuss.elastic.co/u/tlv324)\
**Post date:** [March 9, 2016, 2:52pm UTC](https://discuss.elastic.co/t/authenticationerror-with-elastic-cloud/43910/1 "2016-03-09T14:52:28Z")

</div>

My Cluster ID: 126812  
I am trying to connect to my cluster using a NuGet package that allows me to define my host, the index name, and the type name.  
For example, LogToElasticsearch("some string here", "[http://id.us-east-1.aws.found.io:9200](http://id.us-east-1.aws.found.io:9200)", "indexname", "typename")

However, in order to use Kibana 4 I needed to configure Shield, but now when with Shield configured I can no longer index data because my cluster is protected. How do I add authentication so I can start indexing data again.

I tried a suggestion of using [http://username:password@id.us-east-1.aws.found.io:9200](http://username:password@id.us-east-1.aws.found.io:9200) but that was also unsuccessful for me.

---

<div class="post-metadata">

**Author:** ![Xu\_Zhang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xu_zhang/32/4706_2.png) [@Xu\_Zhang](https://discuss.elastic.co/u/Xu_Zhang)\
**Post date:** [March 9, 2016, 7:02pm UTC](https://discuss.elastic.co/t/authenticationerror-with-elastic-cloud/43910/2 "2016-03-09T19:02:41Z")

</div>

Hi tlv324

I'm not sure if NuGet supports Shield. I think the question is not specific to cloud, the kibana forum would be a better place.

I moved this question to the Kibana category.

Thanks,  
Xu

---

<div class="post-metadata">

**Author:** ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)\
**Post date:** [March 9, 2016, 7:15pm UTC](https://discuss.elastic.co/t/authenticationerror-with-elastic-cloud/43910/3 "2016-03-09T19:15:42Z")

</div>

What NuGet package are you using? You'll likely need to follow any instructions that come with the package for connecting to a protected cluster.

My only suggestion is that you try using your example url with https e.g. `https://username:password@id.us-east-1.aws.found.io:9200`

---

<div class="post-metadata">

**Author:** ![tlv324](https://avatars.discourse-cdn.com/v4/letter/t/46a35a/32.png) [@tlv324](https://discuss.elastic.co/u/tlv324)\
**Post date:** [March 9, 2016, 7:18pm UTC](https://discuss.elastic.co/t/authenticationerror-with-elastic-cloud/43910/4 "2016-03-09T19:18:41Z")

</div>

@Bargs  
Unfortunately, there aren't any instructions for connecting to a protected cluster. It is open-source and the developers don't seem to be working on the project anymore. If I could figure out how to achieve this myself I would but I have no idea.

> **[EnterpriseLibrary.SemanticLogging.Elasticsearch 2.2.5](https://www.nuget.org/packages/EnterpriseLibrary.SemanticLogging.Elasticsearch/)**
>
> The Semantic Logging Application Block provides a set of destinations to persist events published by a subclass of EventSource, This add-on packages adds support to persisting log entries into Elasticsearch.

I am using this NuGet package.

I should also mention I tried using the endpoint for the https as well and got the same error in the logs of Elastic Cloud.

---

<div class="post-metadata">

**Author:** ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)\
**Post date:** [March 9, 2016, 7:46pm UTC](https://discuss.elastic.co/t/authenticationerror-with-elastic-cloud/43910/5 "2016-03-09T19:46:48Z")

</div>

Unfortunately I don't have any experience with this package. Shield authentication works via simple basic auth, so the URL you're trying _should_ work. The only advice I could give is to use something like [Charles](https://www.charlesproxy.com/) to see the details of the http requests the NuGet package is sending to elasticsearch. Sorry I can't be more helpful.

---

<div class="post-metadata">

**Author:** ![tlv324](https://avatars.discourse-cdn.com/v4/letter/t/46a35a/32.png) [@tlv324](https://discuss.elastic.co/u/tlv324)\
**Post date:** [March 9, 2016, 7:53pm UTC](https://discuss.elastic.co/t/authenticationerror-with-elastic-cloud/43910/6 "2016-03-09T19:53:20Z")

</div>

No worries @Bargs ! I will take a look into a bit more eventually. I thought the URL would work as well, might have to look at how the url is parsed and see if there's something there.

---

<div class="post-metadata">

**Author:** ![tlv324](https://avatars.discourse-cdn.com/v4/letter/t/46a35a/32.png) [@tlv324](https://discuss.elastic.co/u/tlv324)\
**Post date:** [April 15, 2016, 7:41pm UTC](https://discuss.elastic.co/t/authenticationerror-with-elastic-cloud/43910/7 "2016-04-15T19:41:02Z")

</div>

> [@Bargs](#):
>
> Unfortunately I don't have any experience with this package. Shield authentication works via simple basic auth, so the URL you're trying should work. The only advice I could give is to use something like Charles to see the details of the http requests the NuGet package is sending to elasticsearch. Sorry I can't be more helpful.

Is Charles similar to wireshark? I've been trying to use Wireshark to look at this issue.

---

<div class="post-metadata">

**Author:** ![tlv324](https://avatars.discourse-cdn.com/v4/letter/t/46a35a/32.png) [@tlv324](https://discuss.elastic.co/u/tlv324)\
**Post date:** [April 15, 2016, 8:42pm UTC](https://discuss.elastic.co/t/authenticationerror-with-elastic-cloud/43910/8 "2016-04-15T20:42:16Z")

</div>

I should also note that in my wireshark logs I cannot see the username:password so I'm assuming the shipper I am using is doing something weird. Luckily its open source so I just need to look at it a bit more and change what isn't working

---

<div class="post-metadata">

**Author:** ![tlv324](https://avatars.discourse-cdn.com/v4/letter/t/46a35a/32.png) [@tlv324](https://discuss.elastic.co/u/tlv324)\
**Post date:** [April 18, 2016, 3:37pm UTC](https://discuss.elastic.co/t/authenticationerror-with-elastic-cloud/43910/9 "2016-04-18T15:37:45Z")

</div>

> [@Bargs](#):
>
> Unfortunately I don't have any experience with this package. Shield authentication works via simple basic auth, so the URL you're trying should work. The only advice I could give is to use something like Charles to see the details of the http requests the NuGet package is sending to elasticsearch. Sorry I can't be more helpful.

I have done some investigation into the shipper I am using and it uses C#'s HttpClient.PostAsync method which basically takes a URI and the content and can take a cancellation token if desired. I am wondering if anyone knows if that could potentially be my issue?

---

<div class="post-metadata">

**Author:** ![tlv324](https://avatars.discourse-cdn.com/v4/letter/t/46a35a/32.png) [@tlv324](https://discuss.elastic.co/u/tlv324)\
**Post date:** [April 18, 2016, 3:51pm UTC](https://discuss.elastic.co/t/authenticationerror-with-elastic-cloud/43910/10 "2016-04-18T15:51:25Z")

</div>

> [@tlv324](#):
>
> I have done some investigation into the shipper I am using and it uses C#'s HttpClient.PostAsync method which basically takes a URI and the content and can take a cancellation token if desired. I am wondering if anyone knows if that could potentially be my issue?

Well I've done a bit more research into this in the last few minutes and yes the HttpClient was my issue. I guess it likes to ignore the username and password in the link and you have to set the Authorization error yourself. Here are two stackoverflow articles which basically explain it.

[http://stackoverflow.com/questions/18478528/how-to-use-credentials-in-httpclient-in-c](http://stackoverflow.com/questions/18478528/how-to-use-credentials-in-httpclient-in-c)

[http://stackoverflow.com/questions/30858890/how-to-use-httpclient-to-post-with-authentication?lq=1](http://stackoverflow.com/questions/30858890/how-to-use-httpclient-to-post-with-authentication?lq=1)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:55pm UTC](https://discuss.elastic.co/t/authenticationerror-with-elastic-cloud/43910/11 "2017-07-06T13:55:50Z")

</div>


