【问题标题】:Flutter + Firebase: how to send email verificationFlutter + Firebase:如何发送电子邮件验证
【发布时间】:2020-12-12 15:05:29
【问题描述】:

我尝试在线阅读,但找不到有关如何使用sendSignInLinkToEmail()的答案

我特别感兴趣的是 actionCodeSettings 是什么以及它应该具有什么价值。提前 Ty。

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

【问题讨论】:

    标签: firebase flutter dart firebase-authentication


    【解决方案1】:

    [新格式]

    _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),
      );
    

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

    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,
          ),
        );
    

    【讨论】:

      【解决方案2】:

      在全新的Flutter/Firebase documentation 中似乎还没有详细记录电子邮件链接登录。

      在这种情况下,我建议查看适用于 Android 的等效 Firebase 文档。在这种情况下,sending an authentication link to the user's email address 上的文档似乎有你需要的东西。您需要创建一个ActionCodeSettings object 并将其传递给sendSignInLinkToEmail 的调用。

      【讨论】:

      • 同意,文档缺少无密码身份验证的用法:/
      猜你喜欢
      • 2020-07-16
      • 2019-06-24
      • 2018-11-21
      • 1970-01-01
      • 2021-12-16
      • 2017-03-17
      • 2017-09-09
      • 2022-01-24
      相关资源
      最近更新 更多