i'm trying to get/write and update data in firestore in react native (0.66.3), Showing error
[Error: [firestore/permission-denied] The caller does not have permission to execute the specified operation.]
i update rules also
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
App code
import React from 'react';
import { Text, View, TouchableOpacity } from 'react-native';
import firestore from '@react-native-firebase/firestore';
import auth from '@react-native-firebase/auth';
export default function App() {
async function addTodo() {
await auth().signInAnonymously().then((res)=> {
console.log(auth().currentUser.uid);
return firestore().collection('document').get();
}).catch((err)=>{
console.log(err);
});
}
return (
<View>
<TouchableOpacity onPress={() => addTodo()} style={{padding:50}}>
<Text>Test </Text>
</TouchableOpacity>
</View>
);
}