I'd like to use this function in docker to authenticate Biq Query and Google Cloud Storage.
authenticate <- function() {
scopes <- c("https://www.googleapis.com/auth/cloud-platform",
'https://www.googleapis.com/auth/spreadsheets',
'https://www.googleapis.com/auth/drive')
token <- gargle::token_fetch(scopes = scopes)
bigrquery::bq_auth(token = token)
googleCloudStorageR::gcs_auth(token = token, token)
}
I append my credentials to docker from ~/.config/gcloud/application_default_credentials.json
. bq_auth
works fine. If I run the function outside the docker, it works fine but I have to interactively sign in.
With docker, I get an error
Error: Non-interactive session and no authentication email selected.
Setup JSON service email auth or specify email in gar_auth(email='me@preauthenticated.com')
Even if I passed my email to gcs_auth
, it didn't work (but I'd like to avoid that). (Please don't just link me the Non-interactive auth website from gargle
.)