TobiasBuchholz / Plugin.Firebase

Wrapper around the native Android and iOS Firebase Xamarin SDKs
MIT License
220 stars 49 forks source link

Correct way to check email verification status #263

Open cagriy opened 9 months ago

cagriy commented 9 months ago

Hello,

I might simply be doing something wrong here.

Given:

    public static void Initialize(IFirebaseAuth firebaseAuth)
    {
        _firebaseAuth = firebaseAuth;
        var handle = _firebaseAuth.AddAuthStateListener (HandleAuthStateDidChangeListener);
    }

I create a user:

      var user = await _firebaseAuth.SignInWithEmailAndPasswordAsync(email, password);
      await user.SendEmailVerificationAsync();

User gets created correctly, AuthStateListener gets called as expected and the verification email arrives.

Then I complete verification.

At this point I expect AuthStateListener to be called again, but this does not happen, and _firebaseAuth.CurrentUser.IsEmailVerified stays false. If I sign in user again, it gets updated and becomes true.

What would be the correct way to either monitor email verification status via the listener or otherwise to update the CurrentUser object from Firebase ?

Many thanks