Accessing Supabase Storage (non-public)

Hi there! I am successfully uploading an image from the user to supabase storage as part of a ticket they create, and storing the file-path in the supabase table.

However, I would like to also be able for them to see the images they have uploaded as part of their ticket, and I am having trouble there. I know how to do it for a public-bucket, but I would like this to be limited to authenticated users, and therefore there is no public URL and instead Supabase suggests the below, which I am not sure the best way to implement with WeWeb / hoping there’s a better alternative given the wider Supabase integrations. Thank you for your help!

supabase says: Assets stored in a non-public bucket are considered private and are not accessible via a public URL like the public buckets.

You can access them only by:

  • Signing a time limited URL on the Server, for example with Edge Functions.
  • with a GET request the URL https://[project_id].supabase.co/storage/v1/object/authenticated/[bucket]/[asset-name] and the user Authorization header

It’s the best way

Thank you Broberto - how do i achieve that within WeWeb?

You could try the AI to get an Edge Function :+1:

appreciate your response! unfortunately the AI has been breaking more than helping, especially with more complex things, so would rather not risk it. please let me know if you know any examples or guides I should take a look at. newer to weweb, so not sure how to do actions like this that would be more typical of a traditional app.

You’d probably handle this in an Edge Function I think, especially when fetching multiple images and doing all sorts of operations.

I don’t think this needs an edge function. The storage | create signed URL should be able to do what you want.

Thank you sam! do you have any resource or link on what you mean/how storage create signed url? thanks!

Good luck creating 5-10 signed URLs with the workflows. That’ll take just 5-10 seconds on slower connections :smiley:

if speeds an issue that’s fair here’s what it looks like for me though

the create signed url is a workflow step

1 Like

Thank you, that is super helpful! very much appreciate you taking the time to show me!

1 Like