# Limiting the audience of an access token to a single value

**URL:** <https://community.auth0.com/t/limiting-the-audience-of-an-access-token-to-a-single-value/127183>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [February 13, 2024, 6:07am UTC](https://community.auth0.com/t/limiting-the-audience-of-an-access-token-to-a-single-value/127183 "2024-02-13T06:07:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pmgdev](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pmgdev/32/54756_2.png) [@pmgdev](https://community.auth0.com/u/pmgdev)\
**Post date:** [February 13, 2024, 6:07am UTC](https://community.auth0.com/t/limiting-the-audience-of-an-access-token-to-a-single-value/127183/1 "2024-02-13T06:07:26Z")

</div>

I have integrated the Auth0 Universal login into my Android app. I am requesting the offline\_access scope to ensure I get a refresh token. I am not including any other scopes. I also set the audience, because my backend requires it to be set in the access token. The problem is when I get my access token and decode it, the `aud` claim is an array containing two audiences, the one I requested and a “[https://my-domain.us.auth0.com/userinfo](https://my-domain.us.auth0.com/userinfo)” audience.

The problem is that I am using an off-the-shelf package called PostgREST for my backend, and it is expecting a single string for the audience - not an array. Is there any way to request an access token and refresh token for a given audience, and not end up with an array of audiences? I was able to accomplish this in my web app using just the Authorization Code Flow, but is it possible when doing the Authorization Code Flow with PKCE?

---

<div class="post-metadata">

**Author:** ![pmgdev](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pmgdev/32/54756_2.png) [@pmgdev](https://community.auth0.com/u/pmgdev)\
**Post date:** [February 14, 2024, 1:33am UTC](https://community.auth0.com/t/limiting-the-audience-of-an-access-token-to-a-single-value/127183/3 "2024-02-14T01:33:01Z")

</div>

For anyone else that sees this, this was an error in my code that attached the access token to the request. I have verified for certain that PostgREST can in fact handle an array of audiences. You can only specify one audience to PostgREST, but as long as that audience is in the array of audiences in the token, you are fine.

---

<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:** [February 14, 2024, 1:47am UTC](https://community.auth0.com/t/limiting-the-audience-of-an-access-token-to-a-single-value/127183/4 "2024-02-14T01:47:08Z")

</div>

Thanks for sharing @pmgdev ! FWIW you can only specify a single audience for Auth0 jwt access tokens, and the second [userinfo](https://auth0.com/docs/api/authentication#get-user-info) audience is included by default.

---

<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:** [February 28, 2024, 1:47am UTC](https://community.auth0.com/t/limiting-the-audience-of-an-access-token-to-a-single-value/127183/5 "2024-02-28T01:47:42Z")

</div>

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