お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、Earth Engine へのアクセスを維持するために
非商用目的での利用資格を確認する必要があります。
ee.data.authenticateViaPrivateKey
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Google API Node.js クライアントを介して EE API 呼び出しのサーバーサイド認証を構成します。秘密鍵認証はサーバーサイドの API 呼び出し専用です。ブラウザベースのアプリケーションの場合は、ee.data.authenticateViaOauth() を使用します。サーバーサイド認証を使用する場合、ユーザー操作(認証ポップアップなど)は必要ありません。
このメソッドまたは別の認証メソッドは、ee.initialize() の前に呼び出す必要があります。
認証トークンは、可能な場合は自動的に更新されます。すべての非同期呼び出しは適切な認証情報とともに送信されると想定して問題ありません。ただし、同期呼び出しの場合は、ee.data.getAuthToken() で認証トークンを確認し、認証トークンがない場合は ee.data.refreshAuthToken() を手動で呼び出す必要があります。トークン更新オペレーションは非同期であり、同期呼び出しの前にオンデマンドでバックグラウンドで実行することはできません。
用途 | 戻り値 |
---|
ee.data.authenticateViaPrivateKey(privateKey, success, error, extraScopes, suppressDefaultScopes) | |
引数 | タイプ | 詳細 |
---|
privateKey | AuthPrivateKey | 秘密鍵の JSON コンテンツ。 |
success | 関数(省略可) | 認証が成功した場合に呼び出す関数。 |
error | 関数(省略可) | 認証に失敗した場合に呼び出す関数。エラー メッセージが渡されます。 |
extraScopes | List<String>(省略可) | リクエストする追加の OAuth スコープ。 |
suppressDefaultScopes | ブール値、省略可 | true の場合、opt_extraScopes で指定されたスコープのみがリクエストされます。opt_extraScopes で明示的に指定されていない限り、デフォルトのスコープはリクエストされません。 |
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[null,null,["最終更新日 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. |"]]