Duyuru:
15 Nisan 2025'ten önce Earth Engine'i kullanmak için kaydedilen tüm ticari olmayan projelerin Earth Engine erişimini sürdürmek için
ticari olmayan uygunluğu doğrulaması gerekir.
ee.data.authenticateViaPrivateKey
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Google APIs Node.js Client aracılığıyla EE API çağrılarının sunucu tarafı kimlik doğrulamasını yapılandırır. Özel anahtar kimlik doğrulaması kesinlikle sunucu tarafı API çağrıları içindir: Tarayıcı tabanlı uygulamalar için ee.data.authenticateViaOauth() işlevini kullanın. Sunucu tarafı kimlik doğrulaması kullanılırken kullanıcı etkileşimi (ör. kimlik doğrulama pop-up'ı) gerekmez.
Bu veya başka bir kimlik doğrulama yöntemi, ee.initialize() çağrılmadan önce çağrılmalıdır.
Yetkilendirme jetonu, mümkün olduğunda otomatik olarak yenilenir. Tüm asenkron çağrıların uygun kimlik bilgileriyle gönderileceğini güvenle varsayabilirsiniz. Ancak senkron çağrılar için ee.data.getAuthToken() ile bir kimlik doğrulama jetonu olup olmadığını kontrol etmeli ve yoksa ee.data.refreshAuthToken() işlevini manuel olarak çağırmalısınız. Jeton yenileme işlemi eşzamansızdır ve eşzamanlı çağrılardan önce isteğe bağlı olarak arka planda gerçekleştirilemez.
Kullanım | İadeler |
---|
ee.data.authenticateViaPrivateKey(privateKey, success, error, extraScopes, suppressDefaultScopes) | |
Bağımsız Değişken | Tür | Ayrıntılar |
---|
privateKey | AuthPrivateKey | Özel anahtarın JSON içeriği. |
success | İşlev, isteğe bağlı | Kimlik doğrulama başarılı olursa çağrılacak işlev. |
error | İşlev, isteğe bağlı | Kimlik doğrulama başarısız olduğunda çağrılacak işlev, hata mesajını iletti. |
extraScopes | List<String>, isteğe bağlı | İstenilecek ek OAuth kapsamları. |
suppressDefaultScopes | Boole değeri, isteğe bağlı | Doğru olduğunda yalnızca opt_extraScopes içinde belirtilen kapsamlar istenir. opt_extraScopes içinde açıkça belirtilmediği sürece varsayılan kapsamlar istenmez. |
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-26 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-26 UTC."],[[["\u003cp\u003eEnables server-side authentication for Earth Engine API calls using a private key, suitable for non-browser environments.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication happens automatically for asynchronous calls, but synchronous calls require manual token checks and refresh using \u003ccode\u003eee.data.getAuthToken()\u003c/code\u003e and \u003ccode\u003eee.data.refreshAuthToken()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eee.data.authenticateViaPrivateKey()\u003c/code\u003e function facilitates this authentication process, accepting the private key and optional success/error callbacks, extra scopes, and a flag to suppress default scopes.\u003c/p\u003e\n"]]],[],null,["# ee.data.authenticateViaPrivateKey\n\n\u003cbr /\u003e\n\nConfigures server-side authentication of EE API calls through the Google APIs Node.js Client. Private key authentication is strictly for server-side API calls: for browser-based applications, use ee.data.authenticateViaOauth(). No user interaction (e.g. authentication popup) is necessary when using server-side authentication.\n\n\u003cbr /\u003e\n\nThis or another authentication method should be called before ee.initialize().\n\nThe auth token will be refreshed automatically when possible. You can safely assume that all async calls will be sent with the appropriate credentials. For synchronous calls, however, you should check for an auth token with ee.data.getAuthToken() and call ee.data.refreshAuthToken() manually if there is none. The token refresh operation is asynchronous and cannot be performed behind-the-scenes, on demand, prior to synchronous calls.\n\n| Usage | Returns |\n|------------------------------------------------------------------------------------------------------------------------|---------|\n| `ee.data.authenticateViaPrivateKey(privateKey, `*success* `, `*error* `, `*extraScopes* `, `*suppressDefaultScopes*`)` | |\n\n| Argument | Type | Details |\n|-------------------------|--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `privateKey` | AuthPrivateKey | JSON content of private key. |\n| `success` | Function, optional | The function to call if authentication succeeded. |\n| `error` | Function, optional | The function to call if authentication failed, passed the error message. |\n| `extraScopes` | List\\\u003cString\\\u003e, optional | Extra OAuth scopes to request. |\n| `suppressDefaultScopes` | Boolean, optional | When true, only scopes specified in opt_extraScopes are requested; the default scopes are not not requested unless explicitly specified in opt_extraScopes. |"]]