Sag*_*gar 4 ios firebase swift firebase-authentication
我正在为我的 iOS 应用程序使用 Firebase 身份验证。现在我想检查输入的电子邮件地址是否可用。我发现我必须使用createUserWithEmailAndPassword
它。但问题是我不想传递密码。我只想使用电子邮件进行检查。我怎样才能做到这一点?
以下是您可能正在寻找的Firebase 函数的结构(Swift 4):
Auth.auth().fetchProviders(forEmail: emailAddress, completion: {
(providers, error) in
if let error = error {
print(error.localizedDescription)
} else if let providers = providers {
print(providers)
}
})
Run Code Online (Sandbox Code Playgroud)
如果电子邮件地址已注册给用户,您将获得电子邮件地址所用提供商的列表。否则,提供商列表将为空,因此电子邮件地址未注册。
您需要使用 fetchProvidersForEmail:completion: https://firebase.google.com/docs/reference/ios/firebaseauth/api/reference/Classes/FIRAuth#-fetchprovidersforemailcompletion
它将返回与该电子邮件关联的提供商 ID 列表。如果您在列表中看到“密码”,则该电子邮件的电子邮件/密码帐户已经存在,您可以显示您的登录页面。
归档时间: |
|
查看次数: |
8658 次 |
最近记录: |