Is it possible to set the upload owner when uploading to Supabase storage?

I am building an API endpoint where the user can upload a file.

The API endpoint/server receives the file data, then checks the API key of the user, and then uploads the file data to Supabase.

But my RLS rules depend on the "owner" column of the uploaded file in the objects table.

When the file is uploaded, there is no "owner" because it was uploaded using service role credentials on a server with no JWT.

Is there a way to specify the owner of an uploaded file in the JavaScript client?

Or is the only way to fall back to using the folder (which is set to the user ID)?
Was this page helpful?