> 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/ar/wthaeq-wajhh-brmjh-alttbyqat/altfwydh-apikey-aw-byanat-alaatmad-aw-oauth-2.0.md).

# التفويض: ApiKey أو بيانات الاعتماد أو OAuth 2.0

حل GeoPard يستخدم [AWS Cognito](https://docs.aws.amazon.com/en_us/cognito/latest/developerguide/what-is-amazon-cognito.html) لإجراء المصادقة.

نوصي بمراجعة جميع خيارات التفويض. يعتمد الاختيار على حالة الاستخدام المحددة. يتم وصف مزيد من تفاصيل الاستخدام في كل خيار أدناه.

## الخيار 1: استخدام بيانات الاعتماد

المصادقة باستخدام "اسم المستخدم" و"كلمة المرور" هي إحدى الطرق الممكنة. في هذه الحالة، يجب إجراء تسجيل عبر البريد الإلكتروني (دون استخدام الشبكات الاجتماعية).&#x20;

{% hint style="info" %}
النهج ***مستحسن للتكامل على مستوى واجهة برمجة التطبيقات (BackEnd)*** وجميع الطلبات إلى واجهة 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 على مستوى واجهة المستخدم (FrontEnd)***. يعمل التكامل في كلا الاتجاهين لإرسال/استقبال البيانات إلى/من GeoPard.
{% endhint %}

باختصار:

1. يجب على تطبيقك إعادة توجيه المستخدم إلى Cognito الخاص بـ GeoPard لتسجيل الدخول أو التسجيل.&#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: مفتاح واجهة برمجة التطبيقات

الوصول السريع إلى WMS و WFS ضروري من وقت لآخر. لذلك، من الممكن استخدام مفتاح واجهة برمجة تطبيقات GeoPard الذي يُنشأ تلقائيًا لكل حساب.

يمكن العثور على مفتاح واجهة برمجة التطبيقات في `مفتاح_API` الخاصية التابعة لكيان GraphQL "UserData". يتم توفير تعليمات حول كيفية استرجاع  `مفتاح_API` مرفقة [هنا](/geopard-tutorials/ar/wthaeq-wajhh-brmjh-alttbyqat/nzrh-aamh-ala-tlbat-wajhh-brmjh-ttbyqat-geopard/38.-astalam-alhswl-ala-byanat-almstkhdm.md).

{% hint style="danger" %}
`مفتاح_API` يجب استخدامه مع `/geo` نقاط النهاية فقط.
{% endhint %}

الاستخدام:

1. كـ `geopardApiKey` معامل في عنوان URL الخاص بطلب GET.
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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.geopard.tech/geopard-tutorials/ar/wthaeq-wajhh-brmjh-alttbyqat/altfwydh-apikey-aw-byanat-alaatmad-aw-oauth-2.0.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
