firebase.UserInfo.providerId的提供程序ID的完整列表是什么? [英] What is the full list of provider id's for firebase.UserInfo.providerId?
问题描述
医生说
例如,"facebook.com"或"google.com".
For example, 'facebook.com', or 'google.com'.
但是,是否有详尽的清单可供使用,我可以依靠它吗?这些ID是否可以是变体,例如"facebook"或"google"(不带.com)?
However, is the exhaustive list available somewhere and can I depend on it? Can these id's ever be a variation, like 'facebook' or 'google' (without the .com)?
上下文:我正在尝试确定已登录用户是否具有社交登录名.因此,我想遍历currentUser.providerData
并将其与已知的providerId列表进行匹配.
Context: I am trying to figure out if the signed in user has a social login. So I want to loop through currentUser.providerData
and match it against a known list of providerIds.
推荐答案
从Firebase控制台上任何项目的身份验证"中的登录方法"子选项卡中,您可以看到可用的登录提供程序的列表:
From the Sign-In Method sub-tab within Authentication found on the Firebase console for any project, you can see a list of available Sign-in providers:
Firebase's documentation doesn't seem to be even across different platforms, but for the iOS Reference docs there is a list of FirebaseAuth Constants that match up with those from the project console dashboard, with the exception of Anonymous provider:
- EmailAuthProviderID
- PhoneAuthProviderID
- GoogleAuthProviderID
- FacebookAuthProviderID
- TwitterAuthProviderID
- GitHubAuthProviderID
- AppleAuthProviderID
- YahooAuthProviderID
- MicrosoftAuthProviderID
从头开始创建新的iOS项目并将此代码添加到didFinishLaunchingWithOptions
方法后:
After making a new iOS project from scratch and adding this code to the didFinishLaunchingWithOptions
method:
FirebaseApp.configure()
print("EmailAuthProviderID: " + EmailAuthProviderID)
print("PhoneAuthProviderID: " + PhoneAuthProviderID)
print("GoogleAuthProviderID: " + GoogleAuthProviderID)
print("FacebookAuthProviderID: " + FacebookAuthProviderID)
print("TwitterAuthProviderID: " + TwitterAuthProviderID)
print("GitHubAuthProviderID: " + GitHubAuthProviderID)
print("AppleAuthProviderID: " + AppleAuthProviderID)
print("YahooAuthProviderID: " + YahooAuthProviderID)
print("MicrosoftAuthProviderID: " + MicrosoftAuthProviderID)
我得到的输出是:
EmailAuthProviderID: password
PhoneAuthProviderID: phone
GoogleAuthProviderID: google.com
FacebookAuthProviderID: facebook.com
TwitterAuthProviderID: twitter.com
GitHubAuthProviderID: github.com
AppleAuthProviderID: apple.com
YahooAuthProviderID: yahoo.com
MicrosoftAuthProviderID: hotmail.com
这篇关于firebase.UserInfo.providerId的提供程序ID的完整列表是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!