# Invalid credentials

**URL:** <https://discuss.elastic.co/t/invalid-credentials/324482>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [February 1, 2023, 10:01pm UTC](https://discuss.elastic.co/t/invalid-credentials/324482 "2023-02-01T22:01:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jorge\_Nunes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jorge_nunes/32/36425_2.png) [@Jorge\_Nunes](https://discuss.elastic.co/u/Jorge_Nunes)\
**Post date:** [February 1, 2023, 10:01pm UTC](https://discuss.elastic.co/t/invalid-credentials/324482/1 "2023-02-01T22:01:44Z")

</div>

I am using the right credentials.  
My instance is deployed in "[https://cloud.elastic.co/deployments/](https://cloud.elastic.co/deployments/)"  
I just need to access the information I installed to enterprise-search from elastic on my machine, from localhost. Do you think this may be a problem like a router port, cors, or firewall? I think this should just work as per the docs.

const { Client } = require('@elastic/enterprise-search');

const client = new Client({  
url: '[[https://my-deployment-124322.ent.eu-west-3.aws.elastic-cloud.com](https://my-deployment-124322.ent.eu-west-3.aws.elastic-cloud.com)](https://my-deployment-  
[124322.ent.eu-west-3.aws.elastic-cloud.com/](http://124322.ent.eu-west-3.aws.elastic-cloud.com/))',  
auth: {  
token: 'private-6khjfgd2ft9s72vsj7kqtd3ygz'  
}  
})`

ResponseError: {"error":"unable\_to\_authenticate\_user"}

p.s. thise credentials are not real, but close enough to state the point that they look like the real ones, but when I try to use the real ones from the elastic AWS UI they return the same responseError. Any idea why this might not be working?

---

<div class="post-metadata">

**Author:** ![joemcelroy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joemcelroy/32/103757_2.png) [@joemcelroy](https://discuss.elastic.co/u/joemcelroy)\
**Post date:** [February 2, 2023, 1:06pm UTC](https://discuss.elastic.co/t/invalid-credentials/324482/2 "2023-02-02T13:06:27Z")

</div>

hi @Jorge_Nunes

How are you performing the request? Is it through the browser or through a node app?  
Looks like you are using the API key correctly so might be something else.

The @elastic/enterprise-search package is only designed for node apps for making server side API calls to Enterprise search. If you're using the browser, you should look into [@elastic/app-search-javascript - npm](https://www.npmjs.com/package/@elastic/app-search-javascript)

Hope this helps!  
Joe

---

<div class="post-metadata">

**Author:** ![Jorge\_Nunes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jorge_nunes/32/36425_2.png) [@Jorge\_Nunes](https://discuss.elastic.co/u/Jorge_Nunes)\
**Post date:** [February 2, 2023, 10:43pm UTC](https://discuss.elastic.co/t/invalid-credentials/324482/3 "2023-02-02T22:43:54Z")

</div>

Hi @joemcelroy

I am using the Node.js version from the following repository:

> **[GitHub - elastic/enterprise-search-js: Official Node.js client for Elastic...](https://github.com/elastic/enterprise-search-js)**
>
> Official Node.js client for Elastic Enterprise Search, App Search, and Workplace Search. - GitHub - elastic/enterprise-search-js: Official Node.js client for Elastic Enterprise Search, App Search, ...

$ node -v  
v18.13.0

I was able to log in with a user and a password instead.

Thanks

- Jorge

---

<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:** [March 2, 2023, 10:44pm UTC](https://discuss.elastic.co/t/invalid-credentials/324482/4 "2023-03-02T22:44:39Z")

</div>

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