I am trying to understand how tokens work in Firebase Storage.
Whenever my web application uploads an image to FS, it adds a token to its public URL. The problem is that whenever you upload the same image file to another part of the web application, it seems that you will not get a different file and a different token for the already downloaded url file, which makes a 403 error for the previous registered image display .
Is there any way to solve this problem?
Example:
storageRef.put(picture.jpg); uploadTask.snapshot.downloadURL
This url is then displayed somewhere inside img src.
<img src="https://firebasestorage.googleapis.com/v0/b/<your-app>/o/picture.jpg?alt=media&token=09cb2927-4706-4e36-95ae-2515c68b0d6e">
If the user repeats this process and uploads the same picture.jpg file in another section of the application, instead of receiving a new copy in Firebase Storage, the file is overwritten with a URL ending with a new token; let's say 12345.
So:
<img src="https://...picture.jpg?alt=media&token=12345"> // New upload renders fine <img src="https://...picture.jpg?alt=media&token=09cb2927-4706..."> // But old upload breaks because of wrong url
source share