# Can't get access token for client

**URL:** <https://community.auth0.com/t/cant-get-access-token-for-client/68379>\
**Category:** Get Help\
**Tags:** jwt, api, access-token, management-api, auth0\
**Created:** [August 23, 2021, 6:50am UTC](https://community.auth0.com/t/cant-get-access-token-for-client/68379 "2021-08-23T06:50:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ph1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ph1/32/12911_2.png) [@ph1](https://community.auth0.com/u/ph1)\
**Post date:** [August 23, 2021, 6:50am UTC](https://community.auth0.com/t/cant-get-access-token-for-client/68379/1 "2021-08-23T06:50:06Z")

</div>

I can’t get access token for my client in application  
My request

```auto
const token: any = await axios.post(
        Endpoints.DOMAIN + Endpoints.GET_ACCESS_TOKEN,
        {
            grant_type: 'client_credentials',
            client_id: process.env.AUTH0_CLIENT_ID,
            client_secret: process.env.AUTH0_CLIENT_SECRET,
            audience: Endpoints.DOMAIN + Endpoints.V2,
        },
        {
            headers: {
                'content-type': 'application/json',
            }
        }
    )

```

Request in documentation

```auto
  url: 'https://domain/oauth/token',
  headers: { 'content-type': 'application/json' },
  body: '{"client_id":"client_id","client_secret":"client_secret","audience":"https://domain/api/v2/","grant_type":"client_credentials"}' };

```

---

<div class="post-metadata">

**Author:** ![supun](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/supun/32/17069_2.png) [@supun](https://community.auth0.com/u/supun)\
**Post date:** [August 23, 2021, 8:18am UTC](https://community.auth0.com/t/cant-get-access-token-for-client/68379/2 "2021-08-23T08:18:22Z")

</div>

Hi @ph1 ,

What’s the error response you get back from the `/oauth/token` endpoint?

---

<div class="post-metadata">

**Author:** ![ph1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ph1/32/12911_2.png) [@ph1](https://community.auth0.com/u/ph1)\
**Post date:** [August 23, 2021, 8:48am UTC](https://community.auth0.com/t/cant-get-access-token-for-client/68379/3 "2021-08-23T08:48:50Z")

</div>

Hi @supun,  
Request:

```auto
data: {
      error: 'unauthorized_client',
      error_description: "Grant type 'client_credentials' not allowed for the client.",
      error_uri: 'https://auth0.com/docs/clients/client-grant-types'
    }

```

---

<div class="post-metadata">

**Author:** ![supun](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/supun/32/17069_2.png) [@supun](https://community.auth0.com/u/supun)\
**Post date:** [August 23, 2021, 9:39am UTC](https://community.auth0.com/t/cant-get-access-token-for-client/68379/4 "2021-08-23T09:39:07Z")

</div>

Hi @ph1 ,

Thank you for the response.

To use the client\_credentials grant with your application, first you need to enable it for the application.

You can enable the client\_credentials grant for your application by navigating to Applications → Select Your Application → Settings → Advanced Settings (bottom of the page) → Grant Types

---

<div class="post-metadata">

**Author:** ![shepardbrisa5](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/shepardbrisa5/32/13031_2.png) [@shepardbrisa5](https://community.auth0.com/u/shepardbrisa5)\
**Post date:** [August 23, 2021, 12:19pm UTC](https://community.auth0.com/t/cant-get-access-token-for-client/68379/5 "2021-08-23T12:19:34Z")

</div>

Did you have a fix on this issue? Facing same issue but no response from anyone. [mcdvoice](https://www.mcdvoice.wtf/)

---

<div class="post-metadata">

**Author:** ![ph1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ph1/32/12911_2.png) [@ph1](https://community.auth0.com/u/ph1)\
**Post date:** [August 23, 2021, 8:14pm UTC](https://community.auth0.com/t/cant-get-access-token-for-client/68379/6 "2021-08-23T20:14:03Z")

</div>

The problem was not solved, since I use a machine to machine connection, and this type is enabled there

---

<div class="post-metadata">

**Author:** ![supun](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/supun/32/17069_2.png) [@supun](https://community.auth0.com/u/supun)\
**Post date:** [August 24, 2021, 8:01am UTC](https://community.auth0.com/t/cant-get-access-token-for-client/68379/7 "2021-08-24T08:01:48Z")

</div>

Hi @ph1,

To further investigate, could you kindly DM me your tenant name and client id?

Thanks!

---

<div class="post-metadata">

**Author:** ![soubhagya](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/soubhagya/32/35629_2.png) [@soubhagya](https://community.auth0.com/u/soubhagya)\
**Post date:** [March 4, 2022, 11:58am UTC](https://community.auth0.com/t/cant-get-access-token-for-client/68379/8 "2022-03-04T11:58:57Z")

</div>

Hi supun,  
To use the client\_credentials grant with your application, first you need to enable it for the application.

You can enable the client\_credentials grant for your application by navigating to Applications → Select Your Application → Settings → Advanced Settings (bottom of the page) → Grant Types  
for this we cant do every time for every time created applications. Is their any settings to do manually enable grant types in advance settings.  
please response soon!!!

Thanks and Regards  
Soubhagya

---

<div class="post-metadata">

**Author:** ![supun](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/supun/32/17069_2.png) [@supun](https://community.auth0.com/u/supun)\
**Post date:** [March 4, 2022, 2:20pm UTC](https://community.auth0.com/t/cant-get-access-token-for-client/68379/9 "2022-03-04T14:20:08Z")

</div>

Hi @soubhagya ,

Welcome to the Auth0 Community!

I’m afraid, there’s no Dashboard UI setting available to pre-set the enabled grant types for newly created applications. However, if you use the Auth0 Management API to [create applications](https://auth0.com/docs/api/management/v2#!/Clients/post_clients), you can set the enabled grant types at the time of application creation.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 19, 2022, 2:20pm UTC](https://community.auth0.com/t/cant-get-access-token-for-client/68379/10 "2022-03-19T14:20:52Z")

</div>

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