Unable to upload file in public app - Missing Access Token error

I have a public retool app, and I'm using the File Input to allow the user to select a file to upload. For interaction I have the following settings:

When I try to upload a file using the app accessing it via the public share link I get the error:
Authentication failure. Missing access token

Is there something else that I need to configure to allow public uploads?

I remember several posts from retool admin team (but dating from late 2023) that retool storage is not supported for public apps.

I'm guessing it is still the case if it is not working for you.

Thanks, I've seen those threads, however they all seem to indicate that it should be supported in public apps now.

I've worked around it by creating a resource query to upload to retool storage when a file gets selected by the File Input. However, if that works, I'm not sure why using the Upload interaction in the File Input doesn't.

Hey @APKent! Welcome to the community. :wave:

Thanks for reaching out and bringing this up. There is definitely some inconsistent behavior here that we probably need to address. As you noted, a POST request directly to the /api/files/upload endpoint fails due to lack of access token but we're able to trigger a query without any issues.

The workaround you've implemented seems like the way to go, for the time being, if you want to allow public uploads. I'll talk to our team about clarifying which of these behaviors is intended and provide any updates here when I can!

Actually, I already have an update here. :laughing: I was putting together a reproduction of the issue for our dev team and noticed another inconsistency, which seems to speak to the core of the issue.

The file upload works flawlessly when generating a default public link but fails when using a custom URL.

I'll go ahead and let the team know! Thanks again for catching this. :+1:

3 Likes

Encountering the same issue, glad it is being worked on already.

1 Like

Hey @Darren, I am experiencing this issue and desactivating customURL did not help. Would you have any idea how to make upload to storage work on public app?

Hey @Tonep! I just did some quick testing and deactivating the custom URL still allows me to upload successfully, so I'm not sure what might be happening on your end.

Regardless, the better solution is to take a slightly more manual approach and write a separate query for handling the upload:

This implementation should allow public users to upload to Retool Storage even with a custom URL. :+1: Let me know if that doesn't work for you!