> For the complete documentation index, see [llms.txt](https://docs.geopard.tech/geopard-tutorials/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.geopard.tech/geopard-tutorials/in/api/apikey-credentials-oauth-2.0.md).

# प्राधिकरण: ApiKey, Credentials या OAuth 2.0

GeoPard समाधान उपयोग कर रहा है [AWS Cognito](https://docs.aws.amazon.com/en_us/cognito/latest/developerguide/what-is-amazon-cognito.html) प्रमाणीकरण प्रक्रिया के लिए।

हम सभी प्राधिकरण विकल्पों की जाँच करने की सलाह देते हैं। विकल्प की पसंद विशिष्ट उपयोग के मामले पर निर्भर करती है। अधिक उपयोग निर्देश नीचे हर विकल्प में वर्णित हैं।

## विकल्प 1: क्रेडेंशियल्स का उपयोग

“username” और “password” के साथ प्राधिकरण संभावित तरीकों में से एक है। इस स्थिति में, ईमेल पंजीकरण किया जाना चाहिए (सोशल नेटवर्क का उपयोग नहीं)।&#x20;

{% hint style="info" %}
यह तरीका ***API (बैकएंड) स्तर पर एकीकरण के लिए सुझाया जाता है*** और GeoPard API के सभी अनुरोध एक समर्पित विशेष सेवा (माइक्रोसेवा) के माध्यम से प्रॉक्सी किए जाते हैं।
{% endhint %}

### लॉगिन अनुरोध&#x20;

{% code overflow="wrap" lineNumbers="true" %}

```bash
curl --location --request POST 'https://api.geopard.tech/login' \
--header 'Content-Type: application/json' \
--header 'Content-Type: text/plain' \
--data-raw '{"username":"<email_address>","password":"<password>"}'
```

{% endcode %}

### लॉगिन प्रतिक्रिया

{% hint style="danger" %}
टोकन एक JWT है जिसकी अवधि 30 मिनट है।\
\
सर्वोत्तम अभ्यास यह है कि एक ही टोकन को स्टोर करके सभी अनुरोधों में पुन: उपयोग किया जाए, इसके एक्सपायरी समय की जाँच की जाए और यह समाप्त होने पर (या थोड़ा पहले) नया टोकन प्राप्त किया जाए।
{% endhint %}

```json
{
    "token": "<token_to_use_in_geopard_api>"
}
```

## विकल्प 2: OAuth 2.0

AWS Cognito प्राधिकरण के लिए OAuth 2.0 प्रोटोकॉल का समर्थन करता है। सामान्य अवलोकन लेख में वर्णित है [Cognito OAuth2 मैन्युअल](https://aws.amazon.com/ru/blogs/mobile/understanding-amazon-cognito-user-pool-oauth-2-0-grants/)इस उप-लेख में Authorization Code Grant GeoPard के मामले में सबसे अधिक रोचक है।&#x20;

{% hint style="info" %}
यह तरीका ***GeoPard को उपयोगकर्ता इंटरफेस (फ्रंटएंड) स्तर पर एकीकृत करने की सलाह दी जाती है***। एकीकरण दोनों दिशाओं में काम करता है ताकि GeoPard को/से डेटा भेजा/प्राप्त किया जा सके।
{% endhint %}

संक्षेप में:

1. आपके एप्लिकेशन को लॉगिन या पंजीकरण के लिए उपयोगकर्ता को GeoPard Cognito पर रीडायरेक्ट करना होगा।&#x20;

उदाहरण:

{% code overflow="wrap" lineNumbers="true" %}

```bash
curl --location --request GET '
https://auth.geopard.tech/oauth2/authorize?response_type=code&client_id=<connect_geopard_team>&redirect_uri=http://localhost:8080&state=54321
'
```

{% endcode %}

कृपया, अपना एप्लिकेशन व्यक्तिगत प्राप्त करने के लिए GeoPard टीम से संपर्क करें `client_id`.

2. रीडायरेक्ट किए गए URL को एक सत्यापन प्राप्त होगा `code` अगले चरण के लिए।

रीडायरेक्ट किया गया URL इस प्रकार दिखता है [`http://localhost:8080/?code=eb10956a-6d51-49e5-bbfe-9815e3fdc70a&state=54321`](http://localhost:8080/?code=eb10956a-6d51-49e5-bbfe-9815e3fdc70a\&state=54321).

3. आपके एप्लिकेशन को विनिमय करना होगा `code` के लिए `tokens` (`access_token`, `refresh_token`, `id_token`).

उदाहरण:

{% code overflow="wrap" lineNumbers="true" %}

```bash
curl --location --request POST '
https://auth.geopard.tech/oauth2/token
' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Cookie: XSRF-TOKEN=365e14e1-3c66-477e-b0ef-a9e436a834ee; csrf-state=""; csrf-state-legacy=""' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'code=eb10956a-6d51-49e5-bbfe-9815e3fdc70a' \
--data-urlencode 'client_id=42ajne9u466in6gaf569nth9o9' \
--data-urlencode 'redirect_uri=
http://localhost:8080
'
```

{% endcode %}

## विकल्प 3: API कुंजी

WMS और WFS तक त्वरित पहुँच समय-समय पर आवश्यक होती है। इसलिए, हर खाते के लिए स्वचालित रूप से उत्पन्न GeoPard API कुंजी का उपयोग करना संभव है।

API कुंजी को निम्न में पाया जा सकता है `apiKey` "UserData" GraphQL एंटिटी के attribute में। पुनः प्राप्त करने के निर्देश  `apiKey` प्रदान किए गए हैं [यहाँ](/geopard-tutorials/in/api/geopard-api-3/38.-userdata.md).

{% hint style="danger" %}
`apiKey` का उपयोग किया जाना चाहिए साथ में `/geo` एंडपॉइंट्स के साथ केवल।
{% endhint %}

उपयोग:

1. एक के रूप में `geopardApiKey` GET अनुरोध URL में पैरामीटर।
2. एक के रूप में `X-API-Key` किसी भी अनुरोध में हेडर।<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.geopard.tech/geopard-tutorials/in/api/apikey-credentials-oauth-2.0.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
