Hi @TIMAI2
I've solved all the problems with RealTime Database and now I've switched to Storage.
I've been able to save, retrieve, and delete images in Storage.
Now I'd like to do the same thing by applying the rules in Storage with anonymous authentication.
I set the rule in Storage (and it works well because I tested it with Playground).
INTRODUCTION
I'm following your guide "PART III - Firebase Demo: Secured with Web Component"
QUESTION 1
To display images (described in the "Download a file" section of your guide), I'm using the "World readable" approach (will display image in image component), so I add in blocks "&token=".
Everything works! But my question is: when users of my app will create images, will also be created for each image. How can I retrieve the specific values ββfor each image? (Now, for my tests, I had to copy and paste from the Firebase console from the Storage area... but how will my app do this automatically?)
QUESTION 2
"Upload a file" and "Delete a file" return a 403: permission denied error.
In my blocks, I called the idToken... the same one obtained during signin and used for RealTime DB.
Your app will need to capture the response content after a file upload, extract the url, and then store this in the realtime database in the correct place (along with the other associated data...)
I will need to do some testing to be able to answer your question here. The only thing, after first review, I see that is different is the use of firebasestorage.app after the bucket in your urls.
Not having any issues uploading or downloading/viewing files with secure rules in place, FOLLOWING MY GUIDE. I did not use the firebasestorage.app after the bucket.
You may have more success if you simply set your storage secure rules to {bucket} ?
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
I have not an "appspot.com", but firebasestorage.app as you can read in Firebase FAQ
"Starting October 30, 2024, all new default Cloud Storage buckets have the name format PROJECT_ID.firebasestorage.app. Any default buckets created before that date have the name format PROJECT_ID.appspot.com."
The structure of my storage is
PROJECT_ID.firebasestorage.app/TEST/... pictures list...
I'm testing many possibilities from the web...
I have tested to eliminate "_" from the file name in web1 url... nothing
I have tested to separate the rules write/read in 2 lines... nothing