linkIdentiy flow: Identity is already linked to another user

Hi Developers,

For my web app, I have set up anonymous sign-in, which works perfectly as intended. However, there is one issue that I haven't been able to resolve myself.

Once you entered my app, I do create immediately a anonymous user. This means that, when someone signups with a google account for exmaple, that signs out after that. That a new anonymous user gets created.

When this happens, and the user tries to sign back in: i'm getting the following error:

"error":"422: Identity is already linked to another user","level":"info","method":"GET","msg":"422: Identity is already linked to another user","path":"/callback","referer":"http://localhost:3000/","remote_addr"

Which is understandable, but how can I can make it possible that it just throws the whole anonymous signin out of the window when the user signing in with an account that already exists. (triggering: supabase.auth.signInWithOAuth instead of: supabase.auth.linkIdentity)

I don't know the email address before they signin with google since they select their google account in the oauth flow.

I would really appreciate your help.
Was this page helpful?