ee.data.authenticateViaPrivateKey
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
यह कुकी, Google APIs Node.js Client के ज़रिए EE 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 | बूलियन, ज़रूरी नहीं | जब यह वैल्यू सही होती है, तब सिर्फ़ opt_extraScopes में बताए गए स्कोप का अनुरोध किया जाता है. डिफ़ॉल्ट स्कोप का अनुरोध तब तक नहीं किया जाता, जब तक कि उन्हें opt_extraScopes में साफ़ तौर पर न बताया गया हो. |
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 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. |"]]