FlutterFire - Not getting the updated user profile details such as Phone number

Viewed 94

I am using Firebase Phone Authentication in my Flutter app (for Android and iOS). Using same Phone number I have logged into my account in two of my devices. When I update phone number on one device I expect the updated phone number should get a real time update on device2, on which I have subscribed to userChanges() method. But device2 still shows the old phone number.

I have also tried to get updated user profile phone number in device2 using reload() method, but as soon as I call reload() I am being signed out of Firebase account. Kindly help!

1 Answers
  1. It may take up to an hour before device2 refreshes its ID token on its own and will get the updated user profile.

  2. Changing the phone number of a user that is signed in with a phone number, triggers the need for that user to be reauthenticate. So when device2 tries to refresh its ID token, the server tells it to ask the user for the new credentials.

So what you're seeing is the expected behavior, makes sense to me. If you've updated your phone number, the number that device2 authenticated with is no longer valid. If the app allowed the user to remain authenticated based on the previous credentials, that'd be a security risk.

Related