- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
新的 Apple 指南规定,用户应该能够选择退出社交登录并切换到电子邮件登录。
对于 Facebook 和 Twitter 登录,我添加了电子邮件登录。现在,在设置 View 中,我想为社交登录选择退出添加这个选项,但我真的不明白 Firebase 在这种情况下是如何工作的。
我想创建一个新帐户,我想在成功创建帐户后我只需要删除(取消链接)旧提供商。
到目前为止,这是我的代码:
Auth.auth().createUser(withEmail: email, password: password) { (user, error) in
guard let user = user else {
if let error = error as NSError? {
Alertift.alert(title: "", message: error.localizedDescription)
.action(.default("Okay"))
.show(on: self, completion: nil)
}
return
}
if self.isInOptOut {
// Opt-Out flow
print("OPT-OUT FLOW")
let credential = EmailAuthProvider.credential(withEmail: email, password: password)
user.user.linkAndRetrieveData(with: credential, completion: { (result, error) in
if let error = error {
print(error)
Alertift.alert(title: "", message: error.localizedDescription)
.action(.default("Okay"))
.show(on: self, completion: nil)
}
guard let result = result else {
return
}
print(result)
})
}
// Regular flow, go through form
let userProfileFormViewController = UserProfileFormViewController()
userProfileFormViewController.email = user.user.email
userProfileFormViewController.isEmailDisabled = true
self.navigationController?.pushViewController(userProfileFormViewController, animated: true)
}
我收到用户已使用此提供商的错误消息。有人可以指出我正确的方向吗?
更新:
我设法以不同的顺序完成这项工作。
if self.isInOptOut {
guard let currentUser = Auth.auth().currentUser else { print("No user"); return }
// Link with email provider
let credential = EmailAuthProvider.credential(withEmail: email, password: password)
currentUser.linkAndRetrieveData(with: credential, completion: { (authResult, error) in
if let error = error {
Alertift.alert(title: "", message: error.localizedDescription)
.action(.default("Okay"))
.show(on: self, completion: nil)
}
// Unlink from Social provider
if currentUser.providerData.count > 0 {
for provider in currentUser.providerData {
print(provider.providerID)
if provider.providerID == "twitter.com" || provider.providerID == "facebook.com" {
currentUser.unlink(fromProvider: provider.providerID) { (user, error) in
Alertift.alert(title: "", message: "Success. From now on, use only email login.")
.action(.default("I understand"), handler: { _, _, _ in
self.navigationController?.popViewController(animated: true)
})
.show(on: self, completion: nil)
}
}
}
}
})
}
最佳答案
发生错误是因为您为用户创建了一个具有电子邮件身份验证的新帐户,然后您尝试从文档中合并:
The call to linkWithCredential:completion: will fail if the credentials are already linked to another user account.
即您正尝试在两个不同的帐户上使用相同的凭据。
删除.createUser
。 .linkAndRetrieveData
成功后,使用电子邮件提供商登录用户并取消链接社交提供商。
关于swift - Firebase Auth 与新的 Apple 从社交登录中选择退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51449343/
有没有人将 Socialize (getsocialize.com) 与 PhoneGap 集成?我正在开发一个 PhoneGap 应用程序,所以所有的 UI 都是 HTML5,但我的客户希望我们将
晚安 我试图掌握社交 SSO(Facebook/Google 等)如何在微服务架构中工作的概念。 场景 假设我有 2 个后端微服务(Order、User)和一个前端(WebApp) 用户:包含用户个人
Socialblade如何使用youtube api生成live subscriber count? 每个 channel 每秒更新一次。那会不会轻易超过速率限制? 他们从app store desc
我正在尝试在我的(maven)spring MVC secure(spring security)应用程序中配置springsocial,但是当我尝试访问/connect/或/connect/prov
我有一张 table CREATE TABLE `tbl_users` ( `user_id` int(11) NOT NULL auto_increment, `user_username`
这是当前的样本结构 Posts(Collection) - post1Id : { viewCount : 100, likes : 45,
我正在使用快速入门示例中的 Spring Social 和 Thymeleaf 进行开发,但我意识到每个 Controller 只支持一个 Facebook 对象。这意味着示例无法为多个用户提供支持,
我关注了基本的 Spring Social Facebook,它很有效。但它要求我登录浏览器。 您知道如何使用在 Spring 程序中输入的电子邮件和密码登录吗? 图表: 其他程序(发送电子邮件和密码
我想获取我关注的用户帖子列表。在conrtoller我写: @posts = Post.where(id: current_user.followers(User).map(&:id)); 在 Vie
我试图了解 ProviderSignInController 是做什么的,但我很难理解它。 因此,当我单击使用 facebook 登录时,我会转到 facebook 登录页面,然后在输入我的凭据后调用
我正在使用 Spring Boot starter social Facebook 来通过 Facebook 对用户进行身份验证/授权。 我想添加一些 Permissions ,例如 邮箱 为了检索用
我正在使用 Spring Social 通过 Facebook 或 LinkedIn 获取信息。它工作完美,我得到了我想要的,但我遇到了一个问题:它非常慢。 例如,使用 linkedin 访问我的联系
就目前情况而言,这个问题不太适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、民意调查或扩展讨论。如果您觉得这个问题可以改进并可能重新开放,visit
我们正在构建一些“sociable”单元测试(大于“单元”但明确不调用外部服务或数据库的测试)。我想知道如果 future 的开发人员编写了一个确实调用的测试,C# 中是否有一种方法可以让测试运行器抛
有什么方法可以使 Follow Us 文本与 sprite 图像内联? http://jsfiddle.net/e2ScF/66/ Follow us:
我是新来的,在互联网上看过很多这个网站和视频,现在我的 CSS fort 有问题,我会打个招呼,看看是否有人可以帮助我。我正在纠正一个网站,并在我的导航栏上有一个滑动条。但是文本 witch is h
对于那些只想切入正题并知道我在问什么的人。我的问题在下面的段落中进行了编号和加粗。 我费了好大劲想弄清楚1.)如何为 Android 社交网络应用程序实现适当的通知系统?到目前为止,我收集到的所有
我使用 spring 安全登录。现在我正在尝试添加 spring social facebook 登录,但是我得到很多错误信息。 首先,当我尝试使用与 spring social guide 相同的方
我在使用 spring-social 获取 id 和 name 以外的参数时遇到问题。 依赖关系: org.springframework.social
我正在启动 ServiceStack 社交引导 API 示例来看看它是如何工作的。 我点击了“登录”链接,但什么也没发生。我查看了代码(参见附件图片1) sign in 在“登录”链接的点击事件中,我
我是一名优秀的程序员,十分优秀!