Lỗi google earth was unable to send your email message năm 2024
Before you can make requests to Earth Engine through a client library, you must authenticate and use the resultant credentials to initialize the Earth Engine client. Show
Earth Engine Code Editor and JavaScriptAuthentication and initialization are handled automatically in the Code Editor. You may choose to route requests through a Cloud Project from your login at the upper right of the Code Editor. If you are using the JavaScript API (outside of the Code Editor), use one of the authentication helpers in Python and Command LinePrior to using the Earth Engine Python client library, you need to authenticate (verify your identity) and use the resultant credentials to initialize the Python client. The authentication flows use Cloud Projects to authenticate, and they're used for unpaid (free, noncommercial) use as well as paid use. To authenticate and initialize, run
This will first select the best authentication mode for your environment, and prompt you to confirm access for your scripts. If credentials already exist, they are automatically reused - run The initialization step verifies that valid credentials exist, either created from On the command line, the equivalent call is You can also configure a project for all future calls by running import ee ee.Authenticate() 0. The command line and import ee ee.Authenticate() 1 will use this whenever a project is not specified directly. If using authentication through import ee ee.Authenticate() 2 (see below), then the project set by import ee ee.Authenticate() 3 will be used as a final case. Authentication detailsThe aim of the Earth Engine authentication flows is to get a security "token" from your signed-in account which can be stored to give your scripts permission to access your data. For reasons of security, Google's authentication system will only pass such tokens to systems that can be made secure - see technical notes below. Because of the sensitivity to the kind of systems involved, there are different ways to proceed depending on your particular situation. Most options are controlled by the import ee ee.Authenticate() 4 parameter: either as import ee ee.Authenticate() 5, or import ee ee.Authenticate() 6 on the command line. Note that if Google credentials already exist in your environment you may not need to call import ee ee.Authenticate() 8 will also create them. However, import ee ee.Authenticate() 4 parameter, it is designed to work in most situations, but follow the details below if the default mode does not work. The default mode is selected as follows:
If using a Cloud project, pass it to import ee ee.Authenticate() 1. If you do not have access to a project, only `ee.data`3 or the `ee.data`7 mode described below are supported. Quick reference guide and tableThis decision guide outlines the possible options if the default mode selected by
This table shows which combinations of features are supported by each mode. For Local or Remote? Project Needed Scopes Settable Local CLI Needed Project Owner`ee.data`3 local N Y N N`ee.data`1 remote Y N N N import ee ee.Authenticate() 2 both Y Y N N`ee.data`2 both Y Y N Y`ee.data`7 both N Y Y N Credentials for Service Accounts and Compute Engineimport ee ee.Authenticate() 1 will use Earth Engine credentials (which`ee.Authenticate()` stores in `ee.initialize()`5) or retrieve credentials from `ee.initialize()`6, but if necessary you can pass a`ee.initialize()`7 argument to use credentials from elsewhere, bypassing these defaults. If you are authenticating Python code that will run unattended, you may want to authenticate with a service account rather than a user account. See for using service accounts with Earth Engine. Other methods include`ee.initialize()`8 in the Colab auth module and the methods described in the Cloud guide to authenticating as a service account. If your code is running on a Compute Engine VM, a is created for the environment, which import ee ee.Authenticate() 1 will use by default. You may need to if the Cloud Project through which the VM was started is not registered for use with Earth Engine (commercial or non-commercial). Details on modesauth_mode=colab. auth_mode=gcloud. This delegates authentication to the gcloud tool and is the same as running `ee.Authenticate(force=True)`3 with the default Earth Engine scopes (earthengine, cloud-platform, and drive) or the scopes in the `ee.data.authenticateViaPopup()`5 argument. import ee ee.Authenticate() 2 mode works in both local and remote cases. Step-by-step instructions for gcloud mode (local and remote cases)
auth_mode=localhost. This is a gcloud-like flow for cases where gcloud is not installed. It performs the same steps as gcloud, but only works for the local case. You can provide an optional internet port number, eg`ee.Authenticate(force=True)`9, or use `ee.Authenticate()`0 to autoselect a port. The default port is 8085. auth_mode=notebook. This is a general-purpose mode designed to work in remote situations where local command lines are not available. It sends you to the Notebook Authenticator page where you'll need to choose or create an "authentication project" - see details and the troubleshooting guide below. The project passed to import ee ee.Authenticate() 1 does not have to match this - you can keep the same project for authentication while working in different projects in different notebooks. It's recommended to pass a project explicitly to import ee ee.Authenticate() 1, but the authentication project will be used by default. Step-by-step instructions for notebook mode
Notebook mode has a rarely-used `ee.Authenticate()`3 parameter: if set, it runs "noninteractively" and doesn't prompt and wait for you to enter the auth code. Instead, it gives a command to run to save the code. auth_mode=gcloud-legacy. Runs an alternative gcloud flow which authenticates against an Earth Engine-owned project so that no project is needed for import ee ee.Authenticate() 1. Note however that projects are recommended for all new Earth Engine usage. It will attempt to guess when to use the remote case, but remote mode can be forced by passing `ee.Authenticate()`5 (or `ee.Authenticate()`6 on the command line). Step-by-step instructions for gcloud-legacy mode (remote machine)
Authentication projectsYou will need to be an Owner, Editor or OAuth Config Editor on the authentication project used in notebook mode. In many cases, particularly in smaller teams, the authentication project that you use on the Notebook Authenticator page can be the same as the primary project that you use for other work. Due to security concerns, the "OAuth client configuration" on the authentication project is a once-off setup. If you or other users have set up an OAuth client on the project for other reasons, it cannot be removed and you will see an error saying "incompatible OAuth2 client configuration." You will need to use a different project for authentication, or use the colab, localhost or gcloud modes above. TroubleshootingWhat if I cannot create a Cloud Project?Some organisations control who can create Cloud Projects. If you receive an error on the Notebook Authenticator page when trying to create a project, there are a few things to try:
Error: "Earth Engine API has not been used in project XXX before or it is disabled"Firstly, ensure that you have configured a project in import ee ee.Authenticate() 1 or on the command line (the default projects provided by Cloud and Colab will not have Earth Engine enabled). Secondly, ensure that the Earth Engine API is on your project. Error: "Project has an incompatible OAuth2 Client configuration"Cloud projects can only have one OAuth2 Client configuration. You can check if a Cloud project has an OAuth2 Client configuration set by checking the OAuth 2.0 Client IDs on the Credentials page. You need to either select another Cloud project that has a compatible configuration already set up by the Notebook Authenticator, or select or create a Cloud project with no OAuth2 clients. The authenticator will configure this project automatically. Unfortunately, the OAuth system doesn't allow users to delete configurations, so one must use a different project. This project does not have to be the same project that's used for other Earth Engine work. Note that this error does not occur in Colab mode. Error: "gcloud failed. Please check for any errors above and install gcloud if needed."This error may occur if gcloud is not installed or not on your PATH. It may also occur if you call What if I do not have access to a local machine to install gcloud?If you are working in a web-only environment without access to a local terminal, and you still need to use a remote terminal, you can still initialize the command line tool by triggering the notebook mode by running the `earthengine authenticate`6 command. Error 400: redirect_uri_mismatchYou may obtain this error if authenticating on a remote machine without access to a web browser. Try adding `ee.Authenticate()`6 if running `earthengine authenticate`from the command line or `earthengine authenticate`9 if using the Python client. This will require you to authenticate with import ee ee.Authenticate() 2 from a machine that has access to a web browser. Error: "Your application is authenticating by using local Application Default Credentials. The earthengine.googleapis.com API requires a quota project, which is not set by default."This error may occur when Earth Engine cannot determine your project ID. If the Google Cloud troubleshooting options don't work, try running `earthengine authenticate --force`1 or `earthengine authenticate --force`2. Technical notesFor the technically curious: the need for these different credential creation mechanisms comes from the need to pass credentials to a known and trusted environment. Here's a quick discussion of the different cases above. |