Adding new social with a different email after user is logged in

  • I join using my Facebook, my Facebook email is me@abc.com
  • After I logged in with Facebook, I try to add/connect my Twitter, but my Twitter email is me@xyz.com
What actual happens:
Supabase will create a new account for me@xyz.com

What I would like to happen:
Before Supabase goes and creates a new account, I would like to compare the existing account (me@abc.com) vs the one from my Twitter (me@xyz.com).

If the emails are different, don't create the new account but returns a warning message: "The twitter account you are trying to connect has a different email than me@abc.com, please try updating your twitter's email or try with a different twitter account."

If the emails are the same, proceed as normal (Supabase will add Twitter to the existing account with the same email).

Edit (forgot to ask the question):

Is there anyway I can intercept/add some conditions to signInWithOAuth() before Supabase goes and creates a new account?
Was this page helpful?