简体   繁体   English

Flutter + Firebase:如何发送电子邮件验证

[英]Flutter + Firebase: how to send email verification

I tried to read online and can't find an answer on how to use the sendSignInLinkToEmail()我尝试在线阅读,但找不到有关如何使用sendSignInLinkToEmail()的答案

In particular I'm interested in what actionCodeSettings is and what value it should have.我特别感兴趣的是 actionCodeSettings 是什么以及它应该具有什么价值。 Ty in advance.提前泰。

Future verificationEmail(email) async {
  try { 
     FirebaseAuth.instance.sendSignInLinkToEmail(
                                      email: email,
                                      actionCodeSettings: null
      } catch (err) { 
          print(err);
            }
}
                               

[NEW FORMAT] [新格式]

_firebaseAuthInstance.sendSignInLinkToEmail(
    email: "rocky_balboa@example.com,
    actionCodeSettings: ActionCodeSettings(
        url: "https://example.page.link/cYk9",
        androidPackageName: "com.example.app",
        iOSBundleId: "com.example.app",
        handleCodeInApp: true,
        androidMinimumVersion: "16",
        androidInstallApp: true),
  );

[DEPRECATED] (yeah, already...) [已弃用](是的,已经......)

FirebaseAuth.instance.sendSignInLinkToEmail(
      email: "example@example.com",
      actionCodeSettings: ActionCodeSettings(
        url: "https://example.web.app",
        android: {
          'packageName': "com.example.example",
          'installApp': true,
          'minimumVersion': '12'
        },
        iOS: {
          'bundleId': "com.example.example",
        },
        handleCodeInApp: true,
      ),
    );

It looks like email link sign-in is not too well documented yet in the brand new Flutter/Firebase documentation .看起来电子邮件链接登录在全新的Flutter/Firebase 文档中还没有得到很好的记录

In cases like that I recommend looking at the equivalent Firebase documentation for Android.在这种情况下,我建议查看 Android 的等效 Firebase 文档。 In this case the documentation on sending an authentication link to the user's email address seems to have what you need.在这种情况下,有关向用户电子邮件地址发送身份验证链接的文档似乎有您所需要的。 You'll need to create an ActionCodeSettings object and pass that into the call to sendSignInLinkToEmail .您需要创建一个ActionCodeSettings对象并将其传递到对sendSignInLinkToEmail的调用中。

I tried to read online and can't find an answer on how to use the sendSignInLinkToEmail()我尝试在线阅读,但找不到有关如何使用sendSignInLinkToEmail()的答案

In particular I'm interested in what actionCodeSettings is and what value it should have.我特别感兴趣的是 actionCodeSettings 是什么以及它应该具有什么价值。 Ty in advance.提前泰。

Future verificationEmail(email) async {
  try { 
     FirebaseAuth.instance.sendSignInLinkToEmail(
                                      email: email,
                                      actionCodeSettings: null
      } catch (err) { 
          print(err);
            }
}
                               

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM