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().

  authorization_code = NULL,
  quiet = FALSE,
  code_verifier = NULL,
  auth_mode = NULL,
  scopes = NULL,
  force = TRUE



Default: NULL


Suppress warnings, errors, messages? Default: FALSE


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


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


List of scopes to use for authentication. Defaults NULL corresponds to c('', '')


Force authentication even if valid credentials exist? Default: TRUE


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


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 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.


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