# 401 - Bad Audience

**URL:** <https://community.auth0.com/t/401-bad-audience/109494>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [June 19, 2023, 1:36am UTC](https://community.auth0.com/t/401-bad-audience/109494 "2023-06-19T01:36:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![formula1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/formula1/32/48153_2.png) [@formula1](https://community.auth0.com/u/formula1)\
**Post date:** [June 19, 2023, 1:36am UTC](https://community.auth0.com/t/401-bad-audience/109494/1 "2023-06-19T01:36:33Z")

</div>

I’m getting a bad audience response and I’m not sure why

Steps I took

- I created an access\_token
- set the token for testing
- tried `https://{my_domain.}us.auth0.com/api/v2/users`
- recieved a 401

 ![creating-a-token](https://global.discourse-cdn.com/auth0/original/3X/f/7/f73272563390b9e40e6a608133e57536e224eab7.png)  
 ![setting-token-for-testing](https://global.discourse-cdn.com/auth0/original/3X/b/e/be460922882d466c110d4c69f59d44663b738315.png)  
 ![testing-response](https://global.discourse-cdn.com/auth0/original/3X/5/1/514060d9de2a45f04a1697cd787ba1ae318782ec.png)

I have `read:users`, `read:user_idp_tokens`,` read:users_app_metadata` enabled

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [June 19, 2023, 3:54pm UTC](https://community.auth0.com/t/401-bad-audience/109494/3 "2023-06-19T15:54:18Z")

</div>

Hi @formula1,

Welcome to the Auth0 Community!

> [@formula1](#):
>
> I’m getting a bad audience response and I’m not sure why

This issue occurs when you make a client credentials grant request to obtain a Management API access token, but the provided audience value does not match the identifier of the Management API.

In other words, the audience parameter should be set to `https://YOUR_DOMAIN.REGION.auth0.com/api/v2/` in order to generate a valid JWT access token that can be used with the Management API.

For more information, I recommend reviewing our documentation on getting Management API access tokens for production at [this link](https://auth0.com/docs/secure/tokens/access-tokens/get-management-api-access-tokens-for-production).

Please let us know if you have any additional questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![formula1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/formula1/32/48153_2.png) [@formula1](https://community.auth0.com/u/formula1)\
**Post date:** [June 21, 2023, 9:12pm UTC](https://community.auth0.com/t/401-bad-audience/109494/4 "2023-06-21T21:12:59Z")

</div>

Why don’t the access tokens in the test work? Also, the audience for local client development works when the audience is `http://localhost:8081`.

Also in the test the configuration is

```json
{
  "client_id":"krlVBet0lsm75UWfoO2MIfmgXkBaFujM",
  "client_secret": "",
  "audience":"http://localhost:8081",
  "grant_type":"client_credentials"
}

```

Just tried it with the url you sent me: [Get Management API Access Tokens for Production](https://auth0.com/docs/secure/tokens/access-tokens/get-management-api-access-tokens-for-production)

its giving me an `access_denied` error

---

<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:** [July 5, 2023, 9:13pm UTC](https://community.auth0.com/t/401-bad-audience/109494/5 "2023-07-05T21:13:16Z")

</div>

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