Skip to content
Back

oauth logging in, person already exists

  • 0
  • Auth
  • Web
  • Cloud
Brinamite
16 Apr, 2025, 07:06

Dear all,

I recently encountered an issue with Oauth.

For creating new users, it works fine. However, when logging in to an existing user (I had already previously signed up with Oauth), it gives me this error:

URL:https://cloud.appwrite.io/v1/account/sessions/oauth2/google/redirect?state=...

Body: {"message":"A user with the same id, email, or phone already exists in this project.","code":409,"type":"user_already_exists","version":"1.6.2"}

I believe this is an error that was not present in the past, as I was able to login with Oauth without issues.

I am calling the Oauth as follows:

TypeScript
const handleGoogleSignIn = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
        e.preventDefault()
        account.createOAuth2Session(OAuthProvider.Google, redirectUri, redirectUri);
    }
TL;DR
Issue: Error message 'A user with the same id, email, or phone already exists in this project' when trying to log in with Oauth to an existing user. Solution: This error occurs because the user already exists in the project. The issue can be resolved by updating the Oauth call to include unique user identification or handle the login process differently for existing users.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more