Having a problem to extract users data in python application

Hello Auth0 team, i am trying to extract user data by using this api

def get_user_data(user_id):
    auth_token = request.headers.get('Authorization')
    response = requests.get(
        f"https://{current_app.config.get('AUTH_DOMAIN')}/api/v2/users/{user_id}",
        headers={
            "Content-Type": "application/json",
            "Authorization": auth_token,
        },
    )
    print(response)
    # return jsonify(response), 200

the problem is that it throughs an error and I am not really sure why , my user id is auth0|644c04aa9advx05564bfd5df7 as an example. Am i doing something wrong ? for access token scopes i have"read:current_user read:users read:user_idp_tokens update:current_user_metadata"

Thanks in advance :slight_smile:

Actually it was a stupid question, but if someone will find my investigation useful, that’s great. You can’t use user access tokens, instead, each api call on the server needs to have Management API Access Token, but notice if you want to get this token, you also need to update your Grant Types for application.

1 Like

Hi there @yehor welcome to the community!

Thanks a bunch for following up with your solution, glad you were able to get it sorted :slight_smile:

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