Report this

What is the reason for this report?

How does an object owner grant access to specific users?

Posted on November 5, 2019

For example, user A uploads an object using the Spaces API. All the response contains is an ETag. Anyways, I (developer) knows the url (or key) of the object and I can save this in the database or whatever. Accessing the URL of a private object returns an AccessDenied response. What if the owner wants to give access to user B (username on my website is joe123), which DO don’t have an ID of. How do I set the object ACL so that joe123 can access/download it?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

Just came across this answer and decided to write some general guidelines for anyone who comes across this in the future despite the old question.

It sounds like you want to provide access to a private object in Spaces to a specific user on your website. To achieve this, you’ll need to generate a pre-signed URL for that object. With a pre-signed URL, you’re granting temporary access to a file without requiring the recipient to have any additional permissions or access to your Space.

First, use your Spaces API credentials to generate a pre-signed URL. The URL will include an expiration time, so the user can only access the object for a limited time period. Once the pre-signed URL is generated, provide it to the user, allowing them to access and download the object.

You can find more information on generating pre-signed URLs in the DigitalOcean Spaces API documentation.

Keep in mind that this access control is done on your application level, and DigitalOcean will not have any information about user B (joe123 in your case).

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.