Skip to content

Incorrect downloadToken used to access storage item #6882

Closed
@steveoh

Description

@steveoh

[REQUIRED] Describe your environment

  • Operating System version: mac os 11.6.8
  • Browser version: chrome 108.0.5359.98
  • Firebase SDK version: 9.15.0
  • Firebase Product: storage

[REQUIRED] Describe the problem

i'm using an upstream package called reactfire to use this lib with hooks etc for react. I'm trying to debug an issue where the downloadToken for an image is not correct when using the useStorageDownloadURL hook. This appears to ultimately call into the firebase-js-sdk and the ref's getDownloadURL method. This then calls into another getDownloadURL in storage. Then downloadURLHelper get's involved and finally downloadUrlFromResourceString constructs the url.

What i'm finding is that getDownloadUrl is not using the correct token. It's like it gets cached or it's not getting set properly.

As you can see here

image

The token used from downloadTokens in the request is quite different from what was returned from the server.

Steps to reproduce:

  1. Upload an image.
  2. Request the images url to show it on the web
  3. Delete the image
  4. Upload a new image to the same storage location
  5. Request the images url to show it on the web
  6. Request fails with a 403 since the wrong access token was used

Relevant Code:

// I can provide code but it's a few levels away from the source...

refs #FirebaseExtended/reactfire#565

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions