Authenticate with Google Cloud Storage API

gcs_auth(json_file = NULL, token = NULL, email = NULL)



Authentication json file you have downloaded from your Google Project


An existing auth token you may have by other means


The email to default authenticate through


The best way to authenticate is to use an environment argument pointing at your authentication file.

Set the file location of your download Google Project JSON file in a GCS_AUTH_FILE argument

Then, when you load the library you should auto-authenticate

However, you can authenticate directly using this function pointing at your JSON auth file.


if (FALSE) { library(googleCloudStorageR) gcs_auth("location_of_json_file.json") #' # to use your own Google Cloud Project credentials # go to GCP console and download client credentials JSON # ideally set this in .Renviron file, not here but just for demonstration Sys.setenv("GAR_CLIENT_JSON" = "location/of/file.json") library(googleCloudStorageR) # should now be able to log in via your own GCP project gcs_auth() # reauthentication # Once you have authenticated, set email to skip the interactive message gcs_auth(email = "") # or leave unset to bring up menu on which email to auth with gcs_auth() # The googleCLoudStorageR package is requesting access to your Google account. # Select a pre-authorised account or enter '0' to obtain a new token. # Press Esc/Ctrl + C to abort. #1: #2: # you can set authentication for many emails, then switch between them e.g. gcs_auth(email = "") gcs_list_buckets("my-project") # lists what buckets you have access to gcs_auth(email = "") gcs_list_buckets("my-project") # lists second set of buckets }