The docs say
For example, 'facebook.com', or '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)?
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.
Federated identity provider integration Authenticate users by integrating with federated identity providers. The Firebase Authentication SDK provides methods that allow users to sign in with their Google, Facebook, Twitter, and GitHub accounts. Google. iOS Android Web C++ Unity.
In the Firebase console, open the Authentication section. In the Sign in method tab, enable the Phone provider if you haven't already. Open the Phone numbers for testing accordion menu. Provide the phone number you want to test, for example: +1 650-555-3434.
You can easily detect if the user is logged or not by executing: var user = firebase. auth().
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:
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)
The output I get is:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With