简体   繁体   English

Email 创建用户前验证

[英]Email verification before user creation

According to the document , it is possible to have email verified when user().onCreate is triggered.根据文档,触发 user().onCreate 时可以验证 email。 From my understanding, you can send email verification link only after creating an account.据我了解,您必须在创建帐户后才能发送 email 验证链接。 How it is possible?怎么可能?

// On sign up.
exports.processSignUp = functions.auth.user().onCreate(async (user) => {
  // Check if user meets role criteria.
  if (
    user.email &&
    user.email.endsWith('@admin.example.com') &&
    user.emailVerified  // Is this can be true at this moment!?
  ) {
      // Grant access
    } catch (error) {
      console.log(error);
    }
  }
});

The initial claims for a user profile are determined by the provider that creates the initial ID token for that user.用户配置文件的初始声明由为该用户创建初始 ID 令牌的提供者确定。 So any provider can set the emailVerified claim if they want.因此,任何提供商都可以根据需要设置emailVerified声明。

Example of built-in providers that do that:执行此操作的内置提供程序示例:

  • When you sign the user in through an email link it implicitly already verified that they have access to the email address, so emailVerified is set to true .当您通过 email 链接让用户登录时,它隐含地验证了他们可以访问 email 地址,因此emailVerified设置为true
  • Certain providers already know that the user owns a certain email address, such as Google for @gmail.com and Facebook for @facebook.com addresses, and may set emailVerified to true for such addresses automatically.某些提供商已经知道用户拥有某个 email 地址,例如 Google 拥有@gmail.com和 Facebook 拥有@facebook.com地址,并且可能会自动将此类地址的emailVerified设置为true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有没有办法在用户实际注册之前生成 firebase email 验证链接? - Is there a way to generate a firebase email verification link before a user is actually signed up? Firebase Auth,email验证不创建用户? - Firebase Auth, email verification without creating a user? Firebase email 验证甚至在点击链接之前自动发生 - Firebase email verification happens automatically even before clicking the link 如何在 React Native 中向用户发送 Firebase 验证 email(以便用户可以验证他们的电子邮件)? - How do you send a Firebase verification email (so that a user can verify their email) to a user in React Native? Firebase Email 验证无效 - Firebase Email Verification is not working Email OTP验证 - Email OTP verification Firebase 验证 email React - Firebase verification email React 验证email活动不刷新 - Verification email activity not refreshing 当配置无服务器框架并且用户使用 AWS Amplify 注册时,AWS Cognito 用户池不发送验证 email - AWS Cognito user pool does not send verification email when configured with Serverless framework and user signs up with AWS Amplify 对自定义电子邮件使用 firebase 电子邮件验证 - Using firebase email verification for a custom email
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM