# Client is not authorized to access, You need to create a \\"client-grant\\" associated to this API

**URL:** <https://community.auth0.com/t/client-is-not-authorized-to-access-you-need-to-create-a-client-grant-associated-to-this-api/81919>\
**Category:** Get Help\
**Tags:** client-credentials-g\
**Created:** [April 18, 2022, 1:30pm UTC](https://community.auth0.com/t/client-is-not-authorized-to-access-you-need-to-create-a-client-grant-associated-to-this-api/81919 "2022-04-18T13:30:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![selvi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/selvi/32/33945_2.png) [@selvi](https://community.auth0.com/u/selvi)\
**Post date:** [April 18, 2022, 1:30pm UTC](https://community.auth0.com/t/client-is-not-authorized-to-access-you-need-to-create-a-client-grant-associated-to-this-api/81919/1 "2022-04-18T13:30:44Z")

</div>

I am trying to get client credentials, but I am getting below error.

URL:  
POST: [https://domain/oauth/token](https://domain/oauth/token)

Body:  
grant\_type: client\_credentials  
client\_id:  
client\_secret:  
audience:

**Error:**

```auto

{
    "error": "access_denied",
    "error_description": "Client is not authorized to access \"https://dev-f0x4xlzg.us.auth0.com/api/v2/\". You need to create a \"client-grant\" associated to this API. See: https://auth0.com/docs/api/v2#!/Client_Grants/post_client_grants"
}

```

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [April 19, 2022, 12:42am UTC](https://community.auth0.com/t/client-is-not-authorized-to-access-you-need-to-create-a-client-grant-associated-to-this-api/81919/4 "2022-04-19T00:42:06Z")

</div>

Hey there @selvi!

It sounds like the client might not be authorized - You can authorize it by going to **Applications → API → Management API → Machine to Machine Applications** in your tenant dashboard.

 ![Screen_Shot_2022-04-18_at_5_39_03_PM](https://global.discourse-cdn.com/auth0/original/3X/d/5/d5ec899271272884d07121c5b35aff636e306f1f.jpeg)

Hope this helps!

---

<div class="post-metadata">

**Author:** ![selvi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/selvi/32/33945_2.png) [@selvi](https://community.auth0.com/u/selvi)\
**Post date:** [April 19, 2022, 7:37am UTC](https://community.auth0.com/t/client-is-not-authorized-to-access-you-need-to-create-a-client-grant-associated-to-this-api/81919/5 "2022-04-19T07:37:49Z")

</div>

The above error got resolved, but I am still facing some issue after generating client credential , Using that token I am trying to create a new org, but it throws error

POST [https://domain/api/v2/organizations](https://domain/api/v2/organizations)

Content-Type: application/json  
Authorization: Bearer …

```auto

Error:
{
    "statusCode": 401,
    "error": "Unauthorized",
    "message": "Invalid token",
    "attributes": {
        "error": "Invalid token"
    }
}

```

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [April 19, 2022, 11:33pm UTC](https://community.auth0.com/t/client-is-not-authorized-to-access-you-need-to-create-a-client-grant-associated-to-this-api/81919/6 "2022-04-19T23:33:40Z")

</div>

Great, good to know the original issue was resolved!

> [@selvi](#):
>
> ```auto
> Error:
> {
> "statusCode": 401,
> "error": "Unauthorized",
> "message": "Invalid token",
> "attributes": {
> "error": "Invalid token"
> }
> }
> 
> ```

I’ve seen this error crop up when the `audience` is not set correctly - In this case it needs to be `https://YOUR_DOMAIN.auth0.com/api/v2/`

Aside from that, I’d check to make sure the correct permissions (`create:organizations`) are assigned to the M2M app. You can find some details on that here:

> **[Register Machine-to-Machine Applications](https://auth0.com/docs/get-started/auth0-overview/create-applications/machine-to-machine-apps)**
>
> Learn how to register and configure a machine-to-machine (M2M) application using the Auth0 Dashboard and authorize it using the Management API test feature.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 4, 2022, 11:34pm UTC](https://community.auth0.com/t/client-is-not-authorized-to-access-you-need-to-create-a-client-grant-associated-to-this-api/81919/7 "2022-05-04T23:34:38Z")

</div>

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