gpt4 book ai didi

android - Firebase 用户在调用 updateProfile() 方法后不再匿名

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:35:07 24 4
gpt4 key购买 nike

在 Android 应用程序中,我创建了一个匿名用户,然后在用户决定登录时将该用户的数据迁移到 Google/Facebook 授权帐户。

这在使用 FirebaseAuth updateProfile() 方法之前一直运行良好,此后当您调用 isAnonymous() 方法时,用户不再是匿名的。

来自 Firebase API 文档 - https://developers.google.com/android/reference/com/google/firebase/auth/FirebaseUser.html#isAnonymous() :

isAnonymous():

Returns true if the user is anonymous; that is, the user account was created with signInAnonymously() and has not been linked to another account with linkWithCredential(AuthCredential).

FirebaseUser updateProfile() 方法:

FirebaseAuth.getInstance().currentUser?.updateProfile(
UserProfileChangeRequest.Builder()
.setDisplayName("Anonymous User")
.build())

调用上面的方法是为了稍后在应用程序中我可以检查匿名用户的显示名称并将其写入数据库等。

根据 API 文档,在调用 linkWithCredential() 或用户使用身份验证提供程序方法登录之前,用户被视为匿名用户,那么为什么 updateProfile() 方法使匿名用户不再匿名?

最佳答案

这里是 firebaser

这是 Firebase Android SDK 中的错误。它自 2016 年 I/O 前后推出 9.0 版以来就一直存在。现在我们知道了,它将在即将发布的版本中修复(尽管我还不知道会是哪个版本)。

关于android - Firebase 用户在调用 updateProfile() 方法后不再匿名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47814347/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com