# Unable to authenticate using nodejs client

**URL:** <https://forum.keycloak.org/t/unable-to-authenticate-using-nodejs-client/12240>\
**Category:** Securing applications\
**Created:** [November 22, 2021, 11:28am UTC](https://forum.keycloak.org/t/unable-to-authenticate-using-nodejs-client/12240 "2021-11-22T11:28:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maisnamraju](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/maisnamraju/32/4449_2.png) [@maisnamraju](https://forum.keycloak.org/u/maisnamraju)\
**Post date:** [November 22, 2021, 11:28am UTC](https://forum.keycloak.org/t/unable-to-authenticate-using-nodejs-client/12240/1 "2021-11-22T11:28:52Z")

</div>

```
 I am trying to authenticate with my keycloak instance using the following credentials but am met with the `error=invalid_client_credentials` in the console. 

```

```auto
 const kcAdminClient = new KcAdminClient({
            baseUrl: process.env.KEYCLOAK_URL,
            realmName: process.env.KEYCLOAK_REALM,
          });
      await kcAdminClient.auth({
        username: "realm-root",
        password: "rolemodel",
        grantType: "password",
        clientId: "cycube",
      });

```

The following is my config in the ui

 ![image](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/2/2515a9ed27f13047c00645808f403d3bbe707324.png)

I have spent the past day trying to figure it out but am totally clueless about what I am doing wrong. Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![jangaraj](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/jangaraj/32/5175_2.png) [@jangaraj](https://forum.keycloak.org/u/jangaraj)\
**Post date:** [November 22, 2021, 2:12pm UTC](https://forum.keycloak.org/t/unable-to-authenticate-using-nodejs-client/12240/2 "2021-11-22T14:12:06Z")

</div>

Your client is `Acess Type: confidential` but your code is not sending any client secret, so `invalid_client_credentials` is valid error for this case. Make sure your client is `public`, not `confidential`.
