Not getting user exists error when creating user whose email is already there.
hey guys I am getting an strange issue, even when user is registered and am trying to create a new user with the same email, it does give response of user objetc but dont get new user with the new user id in the db. how this is happening, it should give throw user exists error.
this is my server actions code creating user.
3 Replies
Supabase does not error if the email exists for security reasons.
https://supabase.com/docs/reference/javascript/auth-signup
Details there.
If you are not using phone auth there is a way described to trick it to send errors using phone auth settings (even if using email).
I am using phone auth also, any why to check user by email ?
You would have to create a Postgres security definer function that takes in an email address and selects from auth.users to see if it is there and returns true or false. Unless you have a profile table with email in it that you can select from the API.
Then you call that with rpc call.
Of course anyone could see if a user is using your app at that point, which is what Supabase is trying to avoid.