【问题标题】:flutter Ignoring header X-Firebase-Locale because its value was null颤动忽略标头X-Firebase-Locale,因为它的值为null
【发布时间】:2021-10-16 10:57:36
【问题描述】:

我将我的应用与 firebase 相关联,但是当我尝试在应用中注册新用户时,我收到了以下错误: 忽略标头 X-Firebase-Locale,因为它的值为 null。 那是验证屏幕代码:

class Authscreen extends StatefulWidget {
  @override
  Authscreenstate createState() => Authscreenstate();
}

final auth = FirebaseAuth.instance;

class Authscreenstate extends State<Authscreen> {
  void submitauthform(String email, String password, String username,
      bool islogin, BuildContext ctx) async {
    UserCredential authres;
    try {
      if (islogin == true) {
        authres = await auth.signInWithEmailAndPassword(
            email: email, password: password);
      } else {
        authres = await auth.createUserWithEmailAndPassword(
            email: email, password: password);
      }
    } on FirebaseAuthException catch (e) {
      String message = "error";
      if (e.code == 'weak-password') {
        message = 'The password provided is too weak.';
      } else if (e.code == 'email-already-in-use') {
        message = 'The account already exists for that email.';
      } else if (e.code == 'user-not-found') {
        message = 'No user found for this email.';
      } else if (e.code == 'wrong-password') {
        message = 'Wrong user privded for that user';
      }
      ScaffoldMessenger.of(context).showSnackBar(
        SnackBar(
          content: Text(message),
          backgroundColor: Theme.of(ctx).errorColor,
        ),
      );
    } catch (e) {
      print(e);
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Theme.of(context).accentColor,
      body: Authform(submitauthform),
    );
  }
}

【问题讨论】:

    标签: flutter dart firebase-authentication


    【解决方案1】:

    确保在Firebase Auth dashboard 上启用电子邮件/密码身份验证作为登录提供程序

    【讨论】:

    • 我的都已启用但仍无法正常工作
    猜你喜欢
    • 2021-03-11
    • 1970-01-01
    • 2022-10-05
    • 2021-02-19
    • 2022-08-23
    • 2021-06-29
    • 2021-04-25
    • 2022-08-08
    相关资源
    最近更新 更多