Kosmo Club
 · Software Developer

Upload user Image to Firestore at the time of SignUp

Resolved

On the signup page, along with other fields like username, email, and password, I also want to save the user image.

The issue is that I have to create the image URL by storing it in the Firestore. This should happen before I create the user document so that I can set the photo_url of the user.

Since, the user is not logged in, the storage of image to firestore before the user is logged in is not working. I think it has to do something with the Firestore rules. Here are my current rules.

May be there is a workaround to do that?

rules_version = '2';

service firebase.storage {

match /b/{bucket}/o {

match /{allPaths=**} {

allow read, write: if false;

}

match /users/{userId}/{allPaths=**} {

allow read: if true;

allow write: if request.auth.uid == userId;

}

}

}

1
6 replies