Get user_id on DB create user, or email when deleting

When in the custom database (https://manage.auth0.com/#/connections/database), when you create a user, the function only gives you access to email but not user_id. When you delete a user, the function only gives you access to the auth0 Id.

I need to either use email or auth0 ID to query the database when I create a user and delete one, how can I do this so creating a user will have auth0 ID …or… deleting a user provides me the email?

**Other solution, how can I query auth0 using a GET request to obtain the user_id when I only have their email? **

Notes:
I’m using a mongoDB database via mLab url.

:wave: @KevinDanikowski you can use the management api to get a user by their email and then extract their userid. I’d have to double check about the database action scripts.. Were you able to solve your issue?

1 Like

I will try this out, but currently working on other aspects of the project so probbably wont come back to confirm. THank you!

Ok, great! In the mean time I will check about your questions regarding the database action scripts . Good luck! Let me know when you get back to this part and we can see what we can do.

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