Firebase email verification not working with Gmail accounts using Flutter?

40 Views Asked by At

I am trying to implement email verification using Firebase. And It's not sending a verification email to a Gmail address like [email protected] but working fine with other email addresses like temp-mail. I check in spam folder as well but email is not found

I'm not able to understand why it's happening. Please help.

I already try all the possible solutions like adding sha keys or verfication checks in code please let me know how i can resolve this issue

 Future<User?> signUpWithEmailPassword({
    required String email,
    required String password,
  }) async {
    try {
      UserCredential userCredential =
          await _auth.createUserWithEmailAndPassword(
        email: email,
        password: password,
      );
      return userCredential.user;
    } on FirebaseAuthException catch (e) {
      if (e.code == 'weak-password') {
        print('The password provided is too weak.');
      } else if (e.code == 'email-already-in-use') {
        print('The account already exists for that email.');
      }
    } catch (e) {
      print(e);
    }
  }


  Future<void> linkWithEmailAndPassword({
    required String email,
    required String password,
  }) async {
    // Email and password sign-in
    final credential =
        EmailAuthProvider.credential(email: email, password: password);

    await _auth.currentUser!.linkWithCredential(credential);
  }



Future<void> resendVerificationEmail() async{
    if (auth.currentUser != null && auth.currentUser!.emailVerified) {
      return await _auth.currentUser!.sendEmailVerification();
    }
    return Future.value();
  }

that's how i am using these functions pleas let me know where i am going wrong?

0

There are 0 best solutions below