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!

Hi @Darren,

just came across this issue again after forgetting for a while that it exists.
I have two dropzones in a form where it works on a normal, internal app.

Once i deploy the app as public, i still get the same error.

I can write a separate query for handling the upload, but which event shall i use on the dropzone component? If i use "change", than also removal of a defined file will trigger the event.

I think the onChange event is the correct one! To prevent the query from running when removing a file, you can explicitly disable it in the advanced settings.

Hi all! Thanks again for flagging this particular issue. We've debated different workarounds internally and ultimately decided to start phasing out the checkbox-based option.

The recommended approach is to instead configure a dedicated upload query, as outlined above. Don't hesitate to follow up here if you have any questions about implementing that!

Hi @Darren , I have this issue as well and I cannot get the workaround working unfortunately.

I have this fileupload button:

The button is configured like this:

It works for a logged in user perfectly.

If a 'public' visitor is uploading the file in an embedded environment I keep getting this Missing access token error.

The button is triggering

Any clue what I am doing wrong? Your help is highly appreciated. Thanks.

Hey @Tom_Suter - I think the query you've written should execute without any issues, but the error message you're seeing is probably the result of still having the Upload to Retool Storage option checked.

Try unselecting that particular option and let me know if you still have issues!

1 Like

Hi @Darren, ah yes, you're right. Now I get it. Sorry, I'm pretty new with Retool. Enjoying it a lot though. Cool that there's a community that helps so fast.

1 Like