# Having a problem to extract users data in python application

**URL:** <https://community.auth0.com/t/having-a-problem-to-extract-users-data-in-python-application/105932>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [May 1, 2023, 8:45pm UTC](https://community.auth0.com/t/having-a-problem-to-extract-users-data-in-python-application/105932 "2023-05-01T20:45:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yehor](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yehor/32/46822_2.png) [@yehor](https://community.auth0.com/u/yehor)\
**Post date:** [May 1, 2023, 8:45pm UTC](https://community.auth0.com/t/having-a-problem-to-extract-users-data-in-python-application/105932/1 "2023-05-01T20:45:54Z")

</div>

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

```auto
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 🙂

---

<div class="post-metadata">

**Author:** ![yehor](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yehor/32/46822_2.png) [@yehor](https://community.auth0.com/u/yehor)\
**Post date:** [May 2, 2023, 12:31am UTC](https://community.auth0.com/t/having-a-problem-to-extract-users-data-in-python-application/105932/2 "2023-05-02T00:31:58Z")

</div>

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](https://auth0.com/docs/secure/tokens/access-tokens/management-api-access-tokens), but notice if you want to get this token, you also need to update your [Grant Types](https://auth0.com/docs/get-started/applications/application-grant-types) for application.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 2, 2023, 1:58am UTC](https://community.auth0.com/t/having-a-problem-to-extract-users-data-in-python-application/105932/3 "2023-05-02T01:58:15Z")

</div>

Hi there @yehor welcome to the community!

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [May 16, 2023, 1:59am UTC](https://community.auth0.com/t/having-a-problem-to-extract-users-data-in-python-application/105932/4 "2023-05-16T01:59:03Z")

</div>

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