0
votes

i have a problem with firebase authentication in flutter. Registration is successful, when i try to log in, after press login button, i have this error

W/Firestore(31652): (21.3.0) [Firestore]: Listen for Query(users/<...UID...>) failed: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}

I/flutter (31652): PlatformException(Error performing get, PERMISSION_DENIED: Missing or insufficient permissions., null)

Login button code is:

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

I also read that a possible solution is to change permissions in firebase, but in that case i allow any users to write and read or not ?

1

1 Answers

0
votes

Make sure that you allow read and write in firebase database rules-

Firebase configuration