An avatar upload is a short-lived write with a surprisingly long tail. The browser needs permission to send bytes without receiving storage credentials, while the application needs a defensible answer to a harder question: when is the old object no longer allowed to exist? The design I use starts with that retention deadline, then derives the upload protocol from it.
Short answer: issue a narrowly scoped presigned PUT URL from the application, keep object names opaque, record an upload intent before handing out the URL, and make deletion a durable state transition rather than a best-effort background task. The URL is transport authorization. It is not proof that an avatar is valid, and it is not an audit record.
The example below uses Go because the important part is the boundary between the API and object storage; the same boundary can be implemented by a Node.js service.…