How To Get A Full User Profile

I keep trying to run this code to get to the full user profile. But this is not working. Is this the correct code for python?
import http.client

conn = http.client.HTTPSConnection(“”)

headers = { ‘authorization’: “Bearer YOUR_ACCESS_TOKEN” }

conn.request(“GET”, “/YOUR_AUTH0_DOMAIN/api/v2/users/USER_ID”, headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode(“utf-8”))

That is the general idea. It would be good to see the actual error message you are getting, and how you are getting YOUR_ACCESS_TOKEN.

I get my access token from the management api. The error message looks like this

I think I see the issue. Looks like you are not putting the “full” Auth0 user ID, there should be the provider followed by a ‘|’ symbol, then the underlying ID. If you look at the user in your manage dashboard, you should see the user_id as something like “auth0|123272349712asdfwe87as” or something like that. Use the full ID.

Ok I tried that. And I still get the same error.

I can’t really see the error from the images. Any chance you can copy and paste it here? Also, it may be worth putting a try/catch around the error and seeing if the exception that is thrown has more information in it. I can only see the stack trace and can’t really tell what the error is trying to say.

Also, you can’t get an access from the management API, you can only get one “for” the management API. You would have to be doing a client credentials flow to get an access token for the management API. Or you can pass the audience of the management API to your /authorize call to get one. If you are using the former, then you would need to have setup a client grant in the manage dashboard. It would be good to know what scopes you granted to it.

If you are using the token that you copied from the manage dashboard on the management API screen, that token will expire after an hour. So you need to make sure you are getting a new token every time you try this. I would suggest using the client credentials grant in your application to fetch a new token and cache it for an hour.