更新时间:2022-06-20 18:58:04
在 3.x 版及更高版本中,单个用户可以使用多个提供程序登录.所以不再有单一提供者 ID 的概念.事实上,当你打电话时:
In version 3.x and later a single user can be signed in with multiple providers. So there is no longer the concept of a single provider ID. In fact when you call:
FirebaseAuth.getInstance().getCurrentUser().getProviderId()
它总是会返回firebase
.
要检测用户是否使用 Facebook 登录,您必须检查提供商数据:
To detect if the user was signed in with Facebook, you will have to inspect the provider data:
for (UserInfo user: FirebaseAuth.getInstance().getCurrentUser().getProviderData()) {
if (user.getProviderId().equals("facebook.com")) {
System.out.println("User is signed in with Facebook");
}
}