# Client Credentials Grant - 500 Error

**URL:** <https://community.auth0.com/t/client-credentials-grant-500-error/7778>\
**Category:** Get Help\
**Tags:** client-credentials-f\
**Created:** [August 8, 2017, 4:44pm UTC](https://community.auth0.com/t/client-credentials-grant-500-error/7778 "2017-08-08T16:44:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisbradley](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@chrisbradley](https://community.auth0.com/u/chrisbradley)\
**Post date:** [August 8, 2017, 4:44pm UTC](https://community.auth0.com/t/client-credentials-grant-500-error/7778/1 "2017-08-08T16:44:58Z")

</div>

Could you advise on the following? I’m trying to use postman to get a token with the following url/object but I’m receiving a 500 in response.

Url: [https://easywebstore.eu.auth0.com/oauth/token](https://easywebstore.eu.auth0.com/oauth/token)

```
{
"grant_type":"client_credentials",
"client_id":"[My client id]",
"client_secret":"[My client secret]",
"audience":"https://easywebstore.eu.auth0.com/api/v2/"
}

```

Response:

```
{
    "error": "server_error",
    "error_description": "Script generated an unhandled asynchronous exception."
}

```

I’ve checked Auth0 Management API and confirm that the Inventory Api is Authorized and all the grants in the scope are checked.

Ultimately, I want to get a token so this client can then get all users.

I noticed that under Dashboard → Clients, the client I’m trying to authenticate is a “Regular Web Application” and not a “Non Interactive”. But then when I go to Dashboard → APIs → Auth0 Management API → Non Interactive Clients, my client is listed there. So I’m assuming my client is both a regular web app and a non interactive client and should therefore be able to authenticate with a client credentials grant. Please let me know if this is not the case.

I’ve also checked Clients → My Client → Advanced Settings → Grants Types. My client has the Grant Type Client Credentials checked.

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [August 8, 2017, 5:30pm UTC](https://community.auth0.com/t/client-credentials-grant-500-error/7778/2 "2017-08-08T17:30:20Z")

</div>

I just tested the client credentials grant against my own account and had no issues. Given the type of error you’re getting the **most likely cause would be that you created a client credentials hook that is throwing an exception**.

If you have configured a hook for this exchange then you can use the real-time logs extension and `console.log` statements in the hook itself to quickly troubleshoot the situation.

---

<div class="post-metadata">

**Author:** ![chrisbradley](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@chrisbradley](https://community.auth0.com/u/chrisbradley)\
**Post date:** [August 8, 2017, 5:47pm UTC](https://community.auth0.com/t/client-credentials-grant-500-error/7778/3 "2017-08-08T17:47:40Z")

</div>

Thanks @jmangelo

We are using a hook so I checked the logs and can see that it’s throwing an exception. I fixed the hook so it no longer throws the exception and am now receiving a 200 with the access token as expected.

Many thanks again.

---

<div class="post-metadata">

**Author:** ![chrisbradley](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@chrisbradley](https://community.auth0.com/u/chrisbradley)\
**Post date:** [August 8, 2017, 5:47pm UTC](https://community.auth0.com/t/client-credentials-grant-500-error/7778/4 "2017-08-08T17:47:40Z")

</div>

Thanks @jmangelo

We are using a hook so I checked the logs and can see that it’s throwing an exception. I fixed the hook so it no longer throws the exception and am now receiving a 200 with the access token as expected.

Many thanks again.

---

<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 2, 2018, 5:55am UTC](https://community.auth0.com/t/client-credentials-grant-500-error/7778/5 "2018-03-02T05:55:49Z")

</div>


