ee.Authenticate

  • ee.Authenticate() is a Python client library function that prompts you to authorize access to Earth Engine via OAuth2.

  • It directs you to an authentication page where you choose a Cloud Project for developer configuration and can opt for read-only access.

  • The credentials obtained are stored persistently on your local machine and automatically used by ee.Initialize().

  • The function takes optional arguments such as authorization_code, quiet, code_verifier, and auth_mode to control the authentication process.

python client library only

Prompts you to authorize access to Earth Engine via OAuth2.

Directs you to a authentication page on the Code Editor server at code.earthengine.google.com/client-auth. You will need to pick a Cloud Project to hold your developer configuration (OAuth Client). This can be the same Cloud Project that you already use in the Code Editor, if you have not set up an OAuth client on the project already.

The setup page also lets you choose to make the notebook access read-only. This is recommended if you are running a notebook with code that you didn't write and which may be malicious. Any operations which try to write data will fail.

The credentials obtained by ee.Authenticate() will be written to a persistent token stored on the local machine. ee.Initialize() will automatically use the persistent credentials, if they exist. To use service account credentials instead, see this guide.

UsageReturns
ee.Authenticate(authorization_code=None, quiet=None, code_verifier=None, auth_mode=None) None
ArgumentTypeDetails
authorization_code String, optional An optional authorization code.
quiet Boolean, optional If true, do not require interactive prompts.
code_verifier String, optional PKCE verifier to prevent auth code stealing.
auth_mode String, optional One of: notebook - Use notebook authenticator. Default for web notebooks, described above. gcloud - Use gcloud. Default for command line calls. appdefault - Read GOOGLE_APPLICATION_CREDENTIALS.