I'm having problems uploading an image to Firebase Storage. I'm using React Native's @react-native-firebase/storage and the installation and connectivity seem to be fine because I'm able to reference images just fine:
const ref = firebase.storage().ref('myImage.png');
The problem is definitely permissions based because when I temporarily remove:
: if request.auth != null
from Firebase console Storage Rules:
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
This worked just fine:
firebase.storage()
.ref('images/test.jpg')
.putFile(myImage[0].path)
.then((successCb) => {
console.log('successCb');
console.log(successCb);
})
.catch((failureCb) => {
console.log('failureCb');
console.log(failureCb);
});
So how do I authenticate to use putFile securely?
EDIT: I'm using "@react-native-firebase/storage": "^6.2.0"
Thanks in advance!
react-native-firebase
) rnfirebase.io/docs/v5.x.x/auth/getting-started – Cantaloupe