0

I'm not going to paste any code because I receive the desired behavior when a user creates account with a phone number in firebase auth.

My problem is after an app update, firebaseUser.getCurrentUser is null despite the fact that the user is already signed up.

My question: How do I mimic a behavior like WhatsApp which doesn't require the user to always go through OTP after every app update?

Iv tried using authState:

auth.addAuthStateListener(firebaseAuth -> {
    user = firebaseAuth.getCurrentUser();
      if(user == null)
          signUp()     });

Hoping after update user won't be null. But it's always null after updating the app.

  • Use an [AuthStateListener](https://stackoverflow.com/questions/50885891/one-time-login-in-app-firebaseauth). – Alex Mamo Apr 21 '21 at 09:46
  • I'm doing exactly that but the listener returns me a null user. The reference you've provided doesn't address how the auth can survive app reinstall (update) – james davison Apr 21 '21 at 09:59
  • Without seeing the code that produces that behavior, it's hard to say why you got `null`. So it's better to provide the code directly in your question. – Alex Mamo Apr 21 '21 at 10:15
  • It seems that the app updating is wiping the refresh token credentials – DIGI Byte Apr 22 '21 at 01:20

1 Answers1

0

Actually what I didn't realize is that I was trying to mimic an update behavior by installing and uninstalling the app. Turns out token credentials are lost in the process. I just assumed Firebase attaches to the device identity some how, some where. I admit I need some instruction