firebase.auth().onAuthStateChanged
only triggers with the FirebaseUser
.
(firebase.auth().onAuthStateChanged
仅使用FirebaseUser
触发。)
You can't get additionalUserInfo
or any credential
eg.(您无法获得additionalUserInfo
或任何credential
例如。)
OAuth tokens associated with the result from that observer.(与该观察者的结果相关联的OAuth令牌。)
You have to get it from the firebase.auth.UserCredential
after the sign-in promise resolves.(登录承诺解析后,您必须从firebase.auth.UserCredential
获取它。)
As these results are only available once on sign-in and Auth does not refresh OAuth credentials or actively update underlying OAuth profiles, Firebase Auth opted not to provide them in onAuthStateChanged
listener as it could mislead developers to think that the listener can be used to listen/get new credentials or additional user data when in reality this information is only available once on sign-in.
(由于这些结果仅在登录时可用一次,并且Auth不会刷新OAuth凭据或主动更新基础OAuth配置文件,因此Firebase Auth选择不在onAuthStateChanged
侦听器中提供它们,因为这可能会误导开发人员,认为该侦听器可用于侦听/获取新凭据或其他用户数据,而实际上该信息仅在登录时可用。)
The observer will only observe changed to the FirebaseUser, eg.
(观察者只会观察到对FirebaseUser的更改,例如。)
sign-in or sign-out events.(登录或退出事件。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…