问题描述
我知道使用UID
是因为它是唯一的.但是在我的应用程序中,所有这些都已使用Google ID注册,Google ID也是唯一的.我应该使用UID
吗?
I know UID
is used because it is unique. But in my app, all of them are registered with Google ID, Google ID is also unique. Should I use UID
?
推荐答案
是,最好使用uid
.从文档中:
yes it is better to use the uid
.From the docs:
您可以通过将Google登录功能集成到您的应用中,让用户使用其Google帐户向Firebase进行身份验证.
因此,在对用户进行身份验证之后,uid
将位于firebase的身份验证页面中. id
稍后还将在firebase数据库中为您提供帮助,并且更易于使用和添加数据库.
So after you authenticate the users, the uid
will be in the authentication page in firebase. That id
will help you later in the firebase database also and it is easier to use and add in the database.
可以很容易地使用它:
FirebaseUser user=FirebaseAuth.getInstance().getCurrentUser();
然后,您可以使用方法getUid()
获取用户ID.因此,使用它会使您的工作更轻松.
Then you can use the method getUid()
to get the userid. So using it will make the work easier for you.
从文档中
也请检查以下链接: https://firebase.google.com/docs/auth/android/google-signin (下一步"部分)
Also check this link: https://firebase.google.com/docs/auth/android/google-signin (Next Step section)
这篇关于为什么在Firebase中使用UID?我应该使用它吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!