【发布时间】:2019-07-11 22:50:11
【问题描述】:
iOS 和 Web 都详细说明了如何处理错误 account-exists-with-different-credential,当尝试使用给定电子邮件登录到已在 firebase auth 中设置的帐户时,该错误会发生。然而Android 文档没有这样的细节,事实上明确的error documentation 没有提供任何额外的信息。似乎缺少的部分是,对于 iOS 和 Web,当错误发生时,凭据仍会返回,但我似乎无法在 Android 上找到它们。那么,如果您从未收到凭据(即使登录成功),您如何使用 link with credentials 方法?
【问题讨论】:
-
@fractalix 感谢您提供的信息,但这些实际上只是突出了问题。是的,可以返回错误,但不会与所需的凭据一起返回。例如,此处firebase.google.com/docs/auth/web/… 返回错误,但您可以使用
var pendingCred = error.credential;获取凭据并使用它来链接帐户。凭据会在 Web 和 iOS 上返回,但不会在 Android 上返回。 -
FirebaseAuthUserCollisionException 有方法 getUpdatedCredential 可以做到这一点:firebase.google.com/docs/reference/android/com/google/firebase/…
-
请检查以下链接以进行查询:stackoverflow.com/questions/40012816/…
-
@fractalix 根据此文档,它仅在使用 PhoneAuthCrendetial firebase.google.com/docs/reference/android/com/google/firebase/… 时抛出,事实上,在我的情况下,它在调用时为空。这对我来说似乎是个错误
标签: android firebase firebase-authentication