Skip to content
Back

OAuth2 Google and Apple throws 409 user already exists.

  • 0
  • Flutter
  • Auth
  • Cloud
Muaaz Joosuf
21 Feb, 2025, 16:03

Hello everyone. I’m using the cloud appwrite to auth my users.

Originally I have had a sign in work successfully and the flow worked well. Suddenly with zero code changes. I am getting this 409 user exists error. I’m uncertain if I have done something wrong. I can share a snippet of my code if need be.

Any help at all would be greatly appreciated.

TypeScript
void handleLogin() async {
    try {
      EasyLoading.show(status: 'Logging you in...');
      // await account.deleteSessions();
      final repository = injector.get<AuthRepository>();
      // Step 1: Start Google Login via Appwrite
      final _ = await account.createOAuth2Session(
        provider: OAuthProvider.google,
      );
      await Future.delayed(const Duration(seconds: 5));
      // Step 2: Fetch User Details
      final user = await account.get();
      final jwtResponse = await account.createJWT();
      FirebaseMessaging messaging = FirebaseMessaging.instance;
      String? token = await messaging.getToken();
      if (token != null) {
        try {
          await account.createPushTarget(targetId: user.$id, identifier: token);
        } catch (_) {
          try {
            await account.updatePushTarget(
              targetId: user.$id,
              identifier: token,
            );
          } catch (_) {
            rethrow;
          }
        }
      }
     
    // backend stuff non app related here
          context.pushReplacementNamed('/home');
        }
      }
    } catch (e) {
      toastLong('Something went wrong: $e');
    } finally {
      EasyLoading.dismiss();
    }
  }
TL;DR
Developers are encountering a 409 user already exists error with OAuth2 Google and Apple in their appwrite cloud authentication. The issue arises suddenly without code changes. They seek assistance to resolve this issue.
Steven
21 Feb, 2025, 16:17

did you delete the user?

Muaaz Joosuf
21 Feb, 2025, 16:48

Should I ? I wasn’t sure what to do

Steven
21 Feb, 2025, 16:57

No I'm just asking if you did before this

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