> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leuwongrr.online/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Cara autentikasi request LeuwongRR User API menggunakan Bearer Token.

# Authentication

LeuwongRR User API menggunakan **User API Token** dengan skema **Bearer Token**.

Setiap endpoint user wajib mengirim header berikut:

```http theme={null}
Authorization: Bearer YOUR_USER_API_TOKEN
Accept: application/json
```

## Format request

```bash theme={null}
curl -H "Authorization: Bearer YOUR_USER_API_TOKEN" \
  -H "Accept: application/json" \
  https://leuwongrr.online/api/v1/me
```

## Validate token

Gunakan endpoint berikut untuk mengecek apakah token masih aktif dan dapat dipakai.

```http theme={null}
POST /api/v1/auth/token/validate
```

```bash theme={null}
curl -X POST "https://leuwongrr.online/api/v1/auth/token/validate" \
  -H "Authorization: Bearer YOUR_USER_API_TOKEN" \
  -H "Accept: application/json"
```

## Endpoint public

Endpoint berikut tidak membutuhkan token:

```txt theme={null}
GET /api/v1/health
GET /api/v1/catalog/robux-packages
GET /api/v1/catalog/payment-methods
GET /api/v1/articles
GET /api/v1/articles/{slug}
```

## Endpoint dengan token

Endpoint berikut wajib memakai User API Token:

```txt theme={null}
POST /api/v1/auth/token/validate
GET  /api/v1/me
GET  /api/v1/me/dashboard-summary
GET  /api/v1/me/balance
GET  /api/v1/me/balance/transactions
GET  /api/v1/me/deposits
GET  /api/v1/me/deposits/{invoice}
POST /api/v1/me/orders
GET  /api/v1/me/orders
GET  /api/v1/me/orders/{invoice}
GET  /api/v1/me/invoices/{invoice}
GET  /api/v1/me/invoices/{invoice}/status
```

## Keamanan token

<Warning>
  User API Token adalah akses pribadi ke data akun kamu sendiri. Jangan bagikan token ke orang lain.
</Warning>

Jangan simpan token di:

* HTML publik
* JavaScript frontend
* Repository GitHub publik
* URL query seperti `?token=...`
* Screenshot publik
* Chat publik

Simpan token di:

* File `.env` backend
* Server bot
* Secret manager
* Environment variable hosting

## Pola yang benar

```txt theme={null}
User membuka website/bot
        ↓
Backend/server kamu membaca token dari ENV
        ↓
Backend/server request ke LeuwongRR API
        ↓
Response aman dikirim ke user
```

## Pola yang salah

```txt theme={null}
Frontend browser
        ↓ token terlihat di DevTools
LeuwongRR User API
```

## Jika token bocor

Jika token dicurigai bocor:

1. Login ke akun LeuwongRR
2. Buka `https://leuwongrr.online/user/api-access`
3. Revoke atau regenerate token
4. Update token baru di backend/server/bot kamu
