Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate a signed URL for google cloud storage objects using Application Default Credentials #339

Open
giovannialberto opened this issue Jan 19, 2025 · 1 comment

Comments

@giovannialberto
Copy link

I am trying to generate signed URLs for downloading some objects stored inside a Google Cloud Storage bucket.

When authenticating through a service account key, everything works as expected. When authenticating through ADC, instead, I am able to just list objects from Cloud Storage but I am not allowed to generate a signed url for downloading them.

Is it possible to achieve URL signing with ADC, rather than relying on the private key stored inside a service account key file?

Thank you.

@yoshidan
Copy link
Owner

yoshidan commented Jan 30, 2025

For users authenticated with ACD, this can be done by specifying the SignBy and google_access_id.

let config = ClientConfig::default().with_auth().await.unwrap();
let client = Client::new(config) ;
let google_access_id = "[email protected]".to_string() 
let url = client.signed_url("your-bukect", "test.csv",
  Some(google_access_id), 
  Some(sign::SignBy::SignBytes), 
  SignedURLOptions::default()
).await.unwrap();  

Service Account Token Creator role is required for users logging in with ACD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants