# Unable to connect to Cloud Platform via Nest

**URL:** <https://discuss.elastic.co/t/unable-to-connect-to-cloud-platform-via-nest/224305>\
**Category:** Elasticsearch\
**Created:** [March 19, 2020, 7:55pm UTC](https://discuss.elastic.co/t/unable-to-connect-to-cloud-platform-via-nest/224305 "2020-03-19T19:55:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Justin\_Williams](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/justin_williams/32/64761_2.png) [@Justin\_Williams](https://discuss.elastic.co/u/Justin_Williams)\
**Post date:** [March 19, 2020, 7:55pm UTC](https://discuss.elastic.co/t/unable-to-connect-to-cloud-platform-via-nest/224305/1 "2020-03-19T19:55:52Z")

</div>

Here is my C# code:

```auto
try
            {
                var credentials = new BasicAuthenticationCredentials(configuration["Elastic:Username"], configuration["Elastic:Password"]);
                var pool = new CloudConnectionPool(configuration.GetConnectionString("CacheConnection"), credentials);

                var settings = new ConnectionSettings(pool)
                    .DefaultMappingFor<Facility>(m => m.IndexName("facilities"))
                    .DefaultMappingFor<TokenCacheEntry>(m => m.IndexName("tokens"))
                    .DefaultMappingFor<VideoModel>(m => m.IndexName("videos"))
                    .DefaultMappingFor<SFUser>(m => m.IndexName("users"))
                    .DefaultIndex("defaultindex");

                _client = new ElasticClient(settings);

                var response = _client.Ping();

                if (!response.IsValid)
                {
                    throw new Exception();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

```

Error received:

Invalid NEST response built from a unsuccessful (401) low level call on HEAD: /

# Audit trail of this API call:

- [1] BadResponse: Node: [https://1642af63f1024125824fbb577713e41c.westus2.azure.elastic-cloud.com:9243/](https://1642af63f1024125824fbb577713e41c.westus2.azure.elastic-cloud.com:9243/) Exception: PipelineException Took: 00:00:00.9987949

# OriginalException: Elasticsearch.Net.ElasticsearchClientException: Could not authenticate with the specified node. Try verifying your credentials or check your Shield configuration.. Call: Status code 401 from: HEAD / ---\> Elasticsearch.Net.PipelineException: Could not authenticate with the specified node. Try verifying your credentials or check your Shield configuration.

at Elasticsearch.Net.RequestPipeline.ThrowBadAuthPipelineExceptionWhenNeeded(IApiCallDetails details, IElasticsearchResponse response) in C:\Source\elasticsearch-net-7.x\src\[Elasticsearch.Net](http://Elasticsearch.Net)\Transport\Pipeline\RequestPipeline.cs:line 573  
at Elasticsearch.Net.RequestPipeline.CallElasticsearch[TResponse](RequestData requestData) in C:\Source\elasticsearch-net-7.x\src\[Elasticsearch.Net](http://Elasticsearch.Net)\Transport\Pipeline\RequestPipeline.cs:line 168  
at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters) in C:\Source\elasticsearch-net-7.x\src\[Elasticsearch.Net](http://Elasticsearch.Net)\Transport\Transport.cs:line 73  
--- End of inner exception stack trace ---

# Audit exception in step 1 BadResponse:

Elasticsearch.Net.PipelineException: Could not authenticate with the specified node. Try verifying your credentials or check your Shield configuration.  
at Elasticsearch.Net.RequestPipeline.ThrowBadAuthPipelineExceptionWhenNeeded(IApiCallDetails details, IElasticsearchResponse response) in C:\Source\elasticsearch-net-7.x\src\[Elasticsearch.Net](http://Elasticsearch.Net)\Transport\Pipeline\RequestPipeline.cs:line 573  
at Elasticsearch.Net.RequestPipeline.CallElasticsearch[TResponse](RequestData requestData) in C:\Source\elasticsearch-net-7.x\src\[Elasticsearch.Net](http://Elasticsearch.Net)\Transport\Pipeline\RequestPipeline.cs:line 168  
at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters) in C:\Source\elasticsearch-net-7.x\src\[Elasticsearch.Net](http://Elasticsearch.Net)\Transport\Transport.cs:line 73

# Request:

\<Request stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.\>

# Response:

\<Response stream not captured or already read to completion by serializer. Set DisableDirectStreaming() on ConnectionSettings to force it to be set on the response.\>

I am able to successfully connect via Postman using my 'elastic' user credentials but when I provide the same credentials to Nest I can't connect.

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [March 19, 2020, 9:57pm UTC](https://discuss.elastic.co/t/unable-to-connect-to-cloud-platform-via-nest/224305/2 "2020-03-19T21:57:38Z")

</div>

It looks like the credentials set in the client are not correct.

If you spin up a [local proxy like Fiddler](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/logging-with-fiddler.html), you'll be able to capture and inspect the Authorization header being sent.

---

<div class="post-metadata">

**Author:** ![Justin\_Williams](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/justin_williams/32/64761_2.png) [@Justin\_Williams](https://discuss.elastic.co/u/Justin_Williams)\
**Post date:** [March 23, 2020, 5:14pm UTC](https://discuss.elastic.co/t/unable-to-connect-to-cloud-platform-via-nest/224305/3 "2020-03-23T17:14:30Z")

</div>

I pulled a dumb and pasted the password in twice. Even when I pulled the value from Fiddler it looked correct and I didn't spot the issue until I tried to log into my Kibana instance with the password I was sending and realized I had pasted it twice.

---

<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:** [April 20, 2020, 5:14pm UTC](https://discuss.elastic.co/t/unable-to-connect-to-cloud-platform-via-nest/224305/4 "2020-04-20T17:14:35Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
