GoogleGenomics (version 1.4.2)

authenticate: Configure how to authenticate for Google Genomics API.

Description

Follow the sign up instructions at https://cloud.google.com/genomics/install-genomics-tools#authenticate to download the client secrets file, or note the clientId and clientSecret pair.

Usage

authenticate(file, clientId, clientSecret, invokeBrowser, apiKey)

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. Service account support needs version 0.1-2 or greater of PKI.
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.

Value

NULL (silently) if successful.

Examples

apiKey <- Sys.getenv("GOOGLE_API_KEY")
if (!is.na(apiKey) && nchar(apiKey)>0) {
  authenticate(apiKey=apiKey)
}
## Not run: 
# authenticate(file="clientSecrets.json")
# authenticate(file="clientSecrets.json", invokeBrowser=FALSE)
# authenticate(clientId="abc", clientSecret="xyz", invokeBrowser=FALSE)
# ## End(Not run)