如果电子邮件未通过验证,Apple将替换电子邮件提供商 [英] Apple replaces email provider if email not verified

查看:263
本文介绍了如果电子邮件未通过验证,Apple将替换电子邮件提供商的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在多个地方(例如此处,但不知道要给用户带来什么样的用户体验.

I have read about this issue in multiple places such as here but do not know what user experience to give users.

我正在iOS(Swift)上使用Firebase Auth.在我的应用中,只有两种方法可以让用户创建帐户:

I'm using Firebase Auth on iOS (Swift). In my app, there are only 2 ways for users to create an account:

  1. 电子邮件(电子邮件/密码)
  2. 使用Apple登录

我不确定在Apple取代Firebase中的电子邮件提供商的情况下如何处理这种情况:

I'm not sure how to handle this scenario where Apple replaces the email provider in Firebase:

  1. 用户使用选项#1(电子邮件)注册为john@gmail.com.我们使用api 发送电子邮件验证来发送电子邮件用户来验证他们的电子邮件.
  2. 由于某种原因,该用户未打开电子邮件以验证其电子邮件.因此,该电子邮件未通过验证.
  3. 用户退出应用程序.
  4. 用户使用选项#2(使用Apple登录)登录,而不是使用选项#1(电子邮件)登录.他们的Apple ID电子邮件与选项#1(电子邮件)相同:john@gmail.com.我们使用API​​ 以以下身份登录凭据.
  1. User signs up with option #1 (Email) as john@gmail.com. We use the api send email verification to send an email for user to verify their email.
  2. This user does not open email to verify their email for some reason. Therefore, the email is not verified.
  3. User logs out of the app.
  4. Instead of the user logging in with option #1 (Email), the user logs in with option #2 (Sign In with Apple). Their Apple ID email is the same as option #1 (Email): john@gmail.com. We use the API sign in with credential.

在此流程中, Apple替换了电子邮件提供商,因为它们的常规电子邮件和Apple ID电子邮件都是相同的(并且常规电子邮件未得到验证).如果电子邮件经过验证,则Firebase在这种情况下会自动链接电子邮件和Apple帐户...而不是替换.

In this flow, Apple replaces the email provider because both their regular email and Apple ID email are the same (and the regular email was not verified). If the email is verified, Firebase links the email and Apple account automatically in this case... instead of replacing.

如果稍后尝试再次创建带有选项#1(电子邮件)的帐户,则会收到此错误,因为它已被Apple使用:

If you try to create an account with option #1 (Email) again later you'll get this error because it is already used with Apple:

Error Domain=FIRAuthErrorDomain Code=17007 "The email address is already in use by another account." UserInfo={NSLocalizedDescription=The email address is already in use by another account., FIRAuthErrorUserInfoNameKey=ERROR_EMAIL_ALREADY_IN_USE}

我不确定如果用户要使用电子邮件登录但现在不能登录,该怎么做以提高用户体验.我是否要告诉用户:抱歉,由于您没有验证电子邮件,因此Apple替换了电子邮件提供商,现在您必须使用Apple登录帐户"?还是我们可以为用户提供更好的用户体验?无论如何,是否可以轻松允许该用户在这种特定情况下同时使用电子邮件和Apple登录?

I'm not sure what to do here for user experience if the user wants to login with email but now can't. Do I tell the user: "Sorry, since you did not verify your email, Apple replaced the email provider as an option and now you have to use Apple to login to your account"? Or is there a better user experience we could provide to user? Is there anyway to easily allow this user to use both email and Apple as a way to login in this specific case?

推荐答案

在这种情况下,您调用fetchSignInMethodsForEmail获取与此电子邮件关联的IDP.这将返回带有apple.com提供程序ID的列表.您通知用户他们需要使用Apple登录该帐户.

In that case, you call fetchSignInMethodsForEmail to get the IdPs associated with this email. That will return a list with apple.com provider ID. You inform the user that they need to sign in with Apple to that account.

展望未来,他们将需要使用Apple登录.使用这两种方法的唯一方法是在使用电子邮件/密码注册之后以及在使用Apple登录之前,是否通过电子邮件验证(通过电子邮件验证).验证帐户后,Apple凭据会在登录时自动合并,并且密码会保留在帐户中.

Going forward they would need to use Apple sign-in. The only way to use both is if you verify the email (via email verification) after they sign up with email/password and before they sign in with Apple. When the account is verified, the Apple credential is merged automatically on sign-in and the password is kept on the account.

这篇关于如果电子邮件未通过验证,Apple将替换电子邮件提供商的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆