Unsolved Get user by email required Admin login

  • GNU/Linux

    Hi all, I want to Read user info by emails,

    Even I have Auth token and header. This API still required Admin login.

    Could anyone share how to Login to Nodebb using Python 3?

    Or Nodebb dev team upgrade this API for using Auth token?

    Thanks,

    headers = {'authorization': 'Bearer %s' % auth_token,
    'content-type': 'application/json'}

    Get user by email
    
    This route retrieves a user's public profile data. If the calling user is the same as the profile, then it will also return data the user elected to hide (e.g. email/fullname). Additionally, this route will only return data **if the calling user is an admin or global moderator**, or if the end user has elected to make their email public. Otherwise, it will simply return a 404 Not Found.
    
  • GNU/Linux Admin

    Hi @Nguyễn-Bảo!

    The API call to retrieve a user by email address is actually not protected behind admin login. It is only privileged if the ACP setting to hide user email addresses is enabled:

    2021-12-13_23-16.png

    You should be able to use an API v3 token (generated from Settings > API Access) to make this call as an administrative user, if you are not willing to change the aforementioned option.

    I am not familiar with Python, but the equivalent cURL command using an API v3 token would be:

    curl -H "Authorization: Bearer your_bearer_token" localhost:4567/api/user/email/[email protected]


Suggested Topics

| | |

© 2014 – 2022 NodeBB, Inc. — Made in Canada.