Auth0 Home Blog Docs

Having no problem making a CURL but receive "BAD_AUDIENCE" when going through Python


Using the example in API doc

curl -H "Authorization: Bearer {My_Token}" https://{My_tenant}

Just to get the clients’ info. This works.

When I go through Python, though

url = urlparse.urljoin(My_tenant, 'api/v2/clients')
headers = {"Authorization": My_Token}
response = requests.get(url, headers=headers)

and I got {u'message': u'Bad audience: https://{My_Tenant}', u'error': u'Unauthorized', u'statusCode': 401}

I double checked my token in and it’s just fine. It has all the permission. Why do I receive this message? I’m doing a GET, how do I pass the audience param (usually in -d) to the call?


Note that I’m implementing this through an API, so I’m calling something that’s not https://{My_Tenant}, say, http://localhost:8000, but should redirect to https://{My_Tenant} with correct credential

Is that the issue?


Ah I figured it out. I was actually using another domain when calling the management API. My bad.