# Custom API not returning user details in react-native-auth0

**URL:** <https://community.auth0.com/t/custom-api-not-returning-user-details-in-react-native-auth0/72578>\
**Category:** Get Help\
**Tags:** react-native, api, auth0\
**Created:** [November 3, 2021, 6:23pm UTC](https://community.auth0.com/t/custom-api-not-returning-user-details-in-react-native-auth0/72578 "2021-11-03T18:23:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gokulnarayan09](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gokulnarayan09/32/24209_2.png) [@gokulnarayan09](https://community.auth0.com/u/gokulnarayan09)\
**Post date:** [November 3, 2021, 6:23pm UTC](https://community.auth0.com/t/custom-api-not-returning-user-details-in-react-native-auth0/72578/1 "2021-11-03T18:23:14Z")

</div>

Hi, I am using a custom api for my react native app and while specifying scopes such as openid I am getting two audiences in the resulting token. One for my custom api and other for **/userinfo** endpoint.But while using this token to get the user details it is throwing error when calling the below function.

**auth0.users(accessToken).getUser({ id: userInfo.sub });**

[Unauthorized: Bad audience: **davas-server** [https://3phtechsolutions.us.auth0.com/userinfo](https://3phtechsolutions.us.auth0.com/userinfo)]

From the error **davas-server** is the custom api identifier. Although userinfo endpoint is present in the audience array it is throwing this error when i am trying to fetch the user details.  
Do anyone have an idea, what might be causing this issue

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 15, 2021, 9:02pm UTC](https://community.auth0.com/t/custom-api-not-returning-user-details-in-react-native-auth0/72578/3 "2021-11-15T21:02:45Z")

</div>

Hi @gokulnarayan09,

Thanks for creating a public topic.

It looks like you are trying to call the management API, which requires a different audience from the /userinfo endpoint. This doc demonstrates how to get management API access tokens in production: [Get Management API Access Tokens for Production](https://auth0.com/docs/security/tokens/access-tokens/get-management-api-access-tokens-for-production).

Although, it looks like you may want to use the userinfo endpoint. An example is available here: [GitHub - auth0/react-native-auth0: React Native toolkit for Auth0 API](https://github.com/auth0/react-native-auth0#get-user-information-using-users-access_token)

---

<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:** [November 30, 2021, 9:03pm UTC](https://community.auth0.com/t/custom-api-not-returning-user-details-in-react-native-auth0/72578/4 "2021-11-30T21:03:24Z")

</div>

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