How to observe firebase.auth().currentUser.displayName and other attributes for changes?

前端 未结 2 1793
独厮守ぢ
独厮守ぢ 2021-01-18 01:11

I am using firebase auth and when users change their profile, such as their displayName, photoURL, or email etc. the onAuthState

2条回答
  •  無奈伤痛
    2021-01-18 01:52

    There aren't any callbacks for when a Firebase Authentication user profile changes. The typical pattern is to write the user profile data into a data store (such as Realtime Database) every time an authentication listener is triggered in a client app. Clients can then listen to the location where profile data for each user lives, and react to those changes on their own. Also, you can use Cloud Functions for Firebase to write a database write trigger that can check to see if anything actually changed when profile data is written, and take action there as needed.

提交回复
热议问题