# Agent Authentication & Discovery for Shein Star Store

Welcome, autonomous agent! This document describes how AI agents can discover, authenticate, and interact with the **Shein Star Store** E-Commerce platform.

---

## 1. Store Overview
* **Name:** Shein Star Store
* **Description:** E-Commerce store offering high quality clothing, accessories, and electronics.
* **Base URL:** `https://neamastore.com`
* **Default Currency:** `YER`

---

## 2. Agent Authentication (OAuth 2.0 / JWT)

Protected endpoints require a standard Bearer JWT token in the `Authorization` HTTP header:

```http
Authorization: Bearer <your_jwt_access_token>
```

### Obtaining an Access Token

#### Method A: Customer / Agent Login
Submit credentials to the token endpoint:
* **POST** `https://neamastore.com/api/auth/token/`
* **Content-Type:** `application/json`
* **Body:**
```json
{
  "email": "agent@example.com",
  "password": "<secure_password>"
}
```
* **Response (HTTP 200):**
```json
{
  "access": "<jwt_access_token>",
  "refresh": "<jwt_refresh_token>",
  "user": {
    "id": 1,
    "email": "agent@example.com",
    "first_name": "AI",
    "last_name": "Agent"
  }
}
```

#### Method B: Google One-Tap / OAuth Credential
* **POST** `https://neamastore.com/api/auth/google/`
* **Body:** `{ "credential": "<google_id_token>" }`

#### Method C: Token Refresh
When the access token expires, renew it seamlessly without re-authenticating:
* **POST** `https://neamastore.com/api/auth/token/refresh/`
* **Body:** `{ "refresh": "<jwt_refresh_token>" }`

---

## 3. Key Agent Endpoints

| Capability | Method | Endpoint | Auth Required |
|---|---|---|---|
| **API Catalog (RFC 9727)** | GET | `/.well-known/api-catalog` | No |
| **ARD Capability Manifest** | GET | `/.well-known/ai-catalog.json` | No |
| **OpenAPI Specification** | GET | `/api/schema/` | No |
| **Swagger UI Documentation** | GET | `/api/docs/` | No |
| **System Health Check** | GET | `/api/health/` | No |
| **Browse Products** | GET | `/api/catalog/products/` | No |
| **Product Categories** | GET | `/api/catalog/categories/` | No |
| **Governorates & Delivery Areas** | GET | `/api/orders/governorates/` | No |
| **Validate Discount Coupon** | POST | `/api/catalog/coupons/validate/` | Optional |
| **Create Order / Checkout** | POST | `/api/orders/checkout/` | Yes (Bearer token) |

---

## 4. Agent Discovery & Standards Compliance

* **RFC 8288 (Link Headers):** Provided on `https://neamastore.com/` with relations: `api-catalog`, `service-desc`, `service-doc`, `authorizationserver`.
* **RFC 9727:** `/.well-known/api-catalog` returning `application/linkset+json`.
* **RFC 9728:** `/.well-known/oauth-protected-resource` declaring resource servers and scopes.
* **RFC 8414:** `/.well-known/openid-configuration` & `/.well-known/oauth-authorization-server`.
* **MCP (Model Context Protocol):** `/.well-known/mcp/server-card.json`.
* **Agent Skills:** `/.well-known/agent-skills/index.json`.
* **Markdown for Agents:** Send `Accept: text/markdown` to `https://neamastore.com/` to receive content in Markdown.

---

## 5. Rate Limits & Usage Guidelines

* Rate limits are enforced on auth endpoints (20 attempts/minute) to maintain service integrity.
* AI agents should supply an identifiable `User-Agent` header (e.g. `MyAgent/1.0 (+https://example.com/bot)`).
* For questions or high-volume agent access, contact support via `https://neamastore.com/contact`.
