我在扑朔迷离的Firebase身份验证时遇到问题。 注册成功,当我尝试登录时,按登录按钮后,出现此错误
W / Firestore(31652):(21.3.0)[Firestore]:侦听查询(用户/ <... UID ...>)失败:状态{code = PERMISSION_DENIED,description =缺少权限或权限不足。 ,cause = null}
I / flutter(31652):PlatformException(执行get时出错,PERMISSION_DENIED:权限缺失或不足。,null)
登录按钮代码为:
child: RaisedButton(
child: Text("Login", style: TextStyle(
fontSize: 18.0,
fontFamily: 'MontserratBold',
),
),
elevation: 5.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0),
),
color: Colors.white,
textColor: Colors.black,
padding: EdgeInsets.all(15.0),
onPressed: () {
if (_loginFormKey.currentState.validate()) {
FirebaseAuth.instance
.signInWithEmailAndPassword(
email: emailInputController.text,
password: pwdInputController.text)
.then((currentUser) => Firestore.instance
.collection("users")
.document(currentUser.user.uid)
.get()
.then((DocumentSnapshot result) =>
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => HomePage(
uid: currentUser.user.uid,
))))
.catchError((err) => print(err)))
.catchError((err) => print(err));
}
},
),
我还读到一种可能的解决方案是更改firebase中的权限,但在那种情况下,我允许任何用户进行读写操作?