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

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]

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

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.

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

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