How to get a download URL for files in Google Cloud Storage?

11,446

You can get the downloadable link replacing the values of the following string:

https://storage.googleapis.com/{bucket.name}/{blob.name}

If you need to limit permissions or time to make the request, you can generate a Signed URL

A signed URL is a URL that provides limited permission and time to make a request. Signed URLs contain authentication information in their query string, allowing users without credentials to perform specific actions on a resource. When you generate a signed URL, you specify a user or service account which must have sufficient permission to make the request that the signed URL will make. After you generate a signed URL, anyone who possesses it can use the signed URL to perform specified actions, such as reading an object, within a specified period of time.

Share:
11,446

Related videos on Youtube

subin_john_
Author by

subin_john_

Updated on September 18, 2022

Comments

  • subin_john_
    subin_john_ over 1 year

    I have created a service using :

    storage.Client(project='project_name', credentials=credentials)

    https://googleapis.dev/python/storage/latest/client.html

    And I'm able to upload, delete and list the files in a users Google Cloud bucket. I've seen an option to download the file to a server, but is there any option to get a downloadable link?

  • subin_john_
    subin_john_ over 4 years
    What I want is to get downloadURL for files(type-not public) in a users Google Cloud bucket using the credentials got after the user authentication. I am able to create a signed url for files in my bucket using the service account file created in the same account. Is there any option similar to AWS where we can create a signed url for files in a another persons bucket using the authentication token.
  • Jaroslav
    Jaroslav over 4 years
    As I understand you want to get object link to download it in web browser?
  • subin_john_
    subin_john_ about 4 years
    yes , but not for the files in my Google Cloud Storage. For the files in a users account using the token got after user authentication
  • Jaroslav
    Jaroslav about 4 years
    Seems this feature is not available in Google Cloud cloud.google.com/storage/docs/access-control/index
  • Jaroslav
    Jaroslav about 4 years
    I will recommend you create Feature Request in GCP here cloud.google.com/support/docs/issue-trackers
  • subin_john_
    subin_john_ about 4 years
    ok will do that
  • vitooh
    vitooh about 3 years
    Any luck with this feature request?
  • Pit
    Pit almost 3 years
    @subin_john_ Please could you share the Feature Request about downloading the file through a link after being authenticated ?
  • drauedo
    drauedo almost 3 years
    Hi Guys! I just found the FR regarding this functionality. Please keep in mind that there is no ETA for the functionality. I suggest to star the issue in order to be notified if there is any updates: issuetracker.google.com/issues/150633508
  • Divyani Yadav
    Divyani Yadav over 2 years
    @subin_john_ Posted an answer, Is it helpful?