jey*_*jey 1 ios facebook-login firebase swift firebase-authentication
我的应用程序正在使用firebase登录facebook和电子邮件密码.现在对于那些使用Facebook签名的用户,我不想验证他们的电子邮件.但Auth.auth().currentUser?.isEmailVerified总是在它的回报中.所以有任何其他方法来检测用户登录Facebook.我知道我可以在登录前在用户默认值中存储值,但在卸载并重新安装应用程序后,我将丢失该用户默认值.虽然firebase保持用户登录.我可以使用keychain,但如果firebase直接提供,那么这将使编码变得容易.
jey*_*jey 10
我找到了一种使用 firebase 方法的解决方案:
if let providerData = Auth.auth().currentUser?.providerData {
for userInfo in providerData {
switch userInfo.providerID {
case "facebook.com":
print("Facebook Login")
//isVerifiededUser = true
default:
print("provider is \(userInfo.providerID)")
}
}
}
Run Code Online (Sandbox Code Playgroud)
您可以使用:
if let user = Auth.auth().currentUser {
if FBSDKAccessToken.current() != nil {
// logged in using facebook
}
else {
// logged in using manual email/password method
}
}
Run Code Online (Sandbox Code Playgroud)
因此,您只能向使用电子邮件/密码方式登录的用户发送验证电子邮件.
| 归档时间: |
|
| 查看次数: |
820 次 |
| 最近记录: |