authenticate: Configure how to authenticate for Google Genomics API.

Description Usage Arguments Details Value Examples

Description

Follow the sign up instructions at https://cloud.google.com/genomics/install-genomics-tools.

Usage

1
2
3
authenticate(file, clientId, clientSecret, invokeBrowser,
  apiKey = Sys.getenv("GOOGLE_API_KEY"),
  gcloudCredsPath = defaultGcloudCredsPath(), tryGCEServiceAccount = TRUE)

Arguments

file

Client secrets file obtained from Google Developer Console. This file could be for a native application or a service account. If this file is not present, clientId and clientSecret must be provided for native application credentials.

clientId

Client ID from Google Developer Console, overridden if file is provided.

clientSecret

Client Secret from Google Developer Console, overridden if file is provided.

invokeBrowser

If TRUE or not provided, the default browser is invoked with the auth URL iff the httpuv package is installed (suggested). If FALSE, a URL is output which needs to be copy pasted in a browser, and the resulting token needs to be pasted back into the R session. With both the options, you will still need to login to your Google account if not logged in already.

apiKey

Public API key that can be used to call the Genomics API for public datasets. This method of authentication does not need you to login to your Google account. Providing this key overrides all other arguments.

gcloudCredsPath

Path to the generated json file with application default credentials.

tryGCEServiceAccount

If TRUE, will try checking if this is a GCE VM instance with a valid service account. If valid credentials are found, will use them over all other options.

Details

There are four primary ways, in order of preference, of authenticating:

1. When running on Google Compute Engine, configure your VM to be authenticated at the time of initial setup. See https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances#using.

2. Use the gcloud tool to generate application default credentials. If the generated file is not in its standard location, you can set the environment variable GOOGLE_APPLICATION_CREDENTIALS with its path, or provide the gcloudCredsPath argument.

3. For public data, use a public API key from the project that you want to access. You can either set the GOOGLE_API_KEY environment variable, or provide the apiKey argument. Does not work with gRPC.

4. Download secrets file (native application or service account) or provide the clientId and clientSecret pair. See https://cloud.google.com/genomics/downloading-credentials-for-api-access. Native application credentials should only be used when accessing data for which your own account is not authorized.

This method is called with default arguments at package load time.

Value

TRUE if successful, FALSE if not.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
apiKey <- Sys.getenv("GOOGLE_API_KEY")
if (!is.na(apiKey) && nchar(apiKey)>0) {
  authenticate(apiKey=apiKey)
}
## Not run: 
authenticate()
authenticate(file="clientSecrets.json")
authenticate(file="clientSecrets.json", invokeBrowser=FALSE)
authenticate(clientId="abc", clientSecret="xyz", invokeBrowser=FALSE)

## End(Not run)

Bioconductor/GoogleGenomics documentation built on May 6, 2019, 7:51 a.m.