Auth Admin "Get User by Email"?
I am writing secure (edge function) logic, allowing an admin to create new users on my app [by email]. Needless to say, there could be a case where a user already exists with the chosen email. I am trying to understand how to best handle this scenario.
I cannot find any mention in the documentation of 'retrieve user by email' only 'retrieve user by id': const { data, error } = await supabase.auth.admin.getUserById(1)
I am wondering if there is something I am missing or if it would be bad practice to search for existing application users by email?
Furthermore, I noticed that using to "invite a new user to the applicaiton" (as the docs said):
const { data, error } = await adminClient.auth.admin.inviteUserByEmail(
request_body.email,
);
...will not throw an error if a user already exists with that email.
Thank you for any help as I explore the 'big picture' of this scenario!
I cannot find any mention in the documentation of 'retrieve user by email' only 'retrieve user by id': const { data, error } = await supabase.auth.admin.getUserById(1)
I am wondering if there is something I am missing or if it would be bad practice to search for existing application users by email?
Furthermore, I noticed that using to "invite a new user to the applicaiton" (as the docs said):
const { data, error } = await adminClient.auth.admin.inviteUserByEmail(
request_body.email,
);
...will not throw an error if a user already exists with that email.
Thank you for any help as I explore the 'big picture' of this scenario!