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 的文档似乎并不跨不同平台,但对于 iOS 参考文档 有一个 FirebaseAuth 常量列表与项目控制台仪表板中的常量相匹配,匿名提供程序除外:
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屋!