Error: Bad Audience while making Auth0 /user/user_id api call

2.7k Views Asked by At

I am having a use case to modify user metadata using Nodejs. I couldn't find any proper documentation on how to do it. So, I thought of using the rest api for modifying the user data. I created an API from the console and added audience as "http://localhost:8080", gave authorization to my existing clients and gave "update:user", "read:user" scopes. I am able to create access_token successfully but I am not able to make the API call to read/update the user data. It's showing "Bad audience". Kindly throw some light on this error (couldn't find proper documentation on this issue).

2

There are 2 best solutions below

2
On

I had this issue but found that under Auth0 dashboard > APIs > whatever api > Non-Interactive Clients > check to Authorized the clients you want.

BUT - i didnt see at first there is a dropdown here once authorized where you turn on whatever defined scopes that have been prepared from the Scopes tab. Because i didnt click this dropdown i never enabled any scopes even though they were defined. Only blew 5 hrs finding this :/

0
On

You have to use 'Auth0 Management API' from the APIs list. If you create your own API it won't work.