I'm trying to upload an image, then have the download location of said image stored in a val. Yesterday it was working 100% perfectly with no issue. I changed no code and I cant upload the image now, now it says
Failed to Upload Image User does not have permission to access this object.
I checked every single stack-overflow/Reddit post with the same topic, and they all say to change permissions of my rules to public.
My rules are set to public
service firebase.storage {
match /b/savephoto-a1cc3.appspot.com/o {
match /{allPaths=**} {
allow read, write;
}
}
}
This is the implementation of uploading the image.
val ref = FirebaseStorage.getInstance().getReference("/images/profilePictures/$filename")
//Stores File
ref.putFile(selectedPhoto!!)
.addOnSuccessListener {
Log.d("main", "Succesfully Uploaded Image ${it.metadata?.path}")
//Gets Download Link for Image
ref.downloadUrl.addOnSuccessListener {
val downloadImg = it.toString()
Log.d("main", "Profile Picture Location $it")
//Create User
createUser(downloadImg, age, gender, firstName, lastName)
}
}
.addOnFailureListener {
Log.d("main", "Failed to Upload Image ${it.message}")
}
}
still unsure why I'm getting a
Failed to Upload Image User does not have permission to access this object.
even when the rules are set to public and my code seems perfectly fine. It was properly uploading images yesterday but now I'm being given this error.