Calls ee.Authenticate(...) to create a local instance of persistent credentials for Google Earth Engine. These credentials are used on subsequent calls to ee.Initialize(...) via gd_initialize().

gd_authenticate(
  authorization_code = NULL,
  quiet = FALSE,
  code_verifier = NULL,
  auth_mode = NULL,
  scopes = NULL,
  force = TRUE
)

Arguments

authorization_code

Default: NULL

quiet

Suppress warnings, errors, messages? Default: FALSE

code_verifier

Code verifier (required if authorization_code is specified). Default: NULL

auth_mode

One of "notebook", "colab", "gcloud", "gcloud-legacy" or (default) NULL to guess based on the current environment.

scopes

List of scopes to use for authentication. Defaults NULL corresponds to c('https://www.googleapis.com/auth/earthengine', 'https://www.googleapis.com/auth/devstorage.full_control')

force

Force authentication even if valid credentials exist? Default: TRUE

Value

This function is primarily used for the side-effect of authentication with the 'Google Earth Engine' servers. Invisibly returns try-error on error.

Details

This method should be called once to set up a machine/project with a particular authentication method.

  • auth_mode="gcloud" (default) fetches credentials using gcloud. Requires installation of command-line Google Cloud tools; see https://cloud.google.com/cli for details. This mode will open a web page where you can sign into your Google Account, then a local JSON file will be stored in gcloud configuration folder with your credentials. These credentials will be used by any library that requests Application Default Credentials (ADC) which are preferred for long-term storage.

  • auth_mode="notebook" argument is intended primarily for interactive or other short-term use. This mode will open a web page where you can sign into your Google Account to generate a short-term, revocable token to paste into the console prompt.

  • auth_mode="appdefault" mode uses locally stored credentials gcloud configuration stored in 'application_default_credentials.json' or JSON file specified by GOOGLE_APPLICATION_CREDENTIALS environment variable.

Examples

if (FALSE) {
# opens web page to complete authentication/provide authorization code
gd_authenticate(auth_mode = "notebook")
}