# Explore Lumajang Authentication API

Base URL for local Android emulator:

```text
http://10.0.2.2:8000/api
```

Base URL for local backend:

```text
http://127.0.0.1:8000/api
```

## Register

`POST /register`

```json
{
  "name": "Lumajang Traveler",
  "email": "traveler@example.com",
  "password": "password123",
  "password_confirmation": "password123"
}
```

Success `201`:

```json
{
  "status": true,
  "message": "Registration successful. Please log in.",
  "data": {
    "user": {
      "id": 1,
      "name": "Lumajang Traveler",
      "email": "traveler@example.com",
      "created_at": "2026-05-14T06:30:00.000000Z"
    }
  }
}
```

## Login

`POST /login`

```json
{
  "email": "traveler@example.com",
  "password": "password123"
}
```

Success `200`:

```json
{
  "status": true,
  "message": "Login successful.",
  "data": {
    "token_type": "Bearer",
    "token": "plain-text-mobile-token",
    "user": {
      "id": 1,
      "name": "Lumajang Traveler",
      "email": "traveler@example.com",
      "created_at": "2026-05-14T06:30:00.000000Z"
    }
  }
}
```

## Profile

`GET /profile`

Header:

```text
Authorization: Bearer plain-text-mobile-token
```

Success `200`:

```json
{
  "status": true,
  "message": "User profile loaded.",
  "data": {
    "user": {
      "id": 1,
      "name": "Lumajang Traveler",
      "email": "traveler@example.com",
      "created_at": "2026-05-14T06:30:00.000000Z"
    }
  }
}
```

## Forgot Password

`POST /forgot-password`

```json
{
  "email": "traveler@example.com"
}
```

Success `200`:

```json
{
  "status": true,
  "message": "Password reset instructions have been sent if the email is registered."
}
```

In local development, the reset token is written to Laravel logs. Configure SMTP before production email delivery.

## Logout

`POST /logout`

Header:

```text
Authorization: Bearer plain-text-mobile-token
```

Success `200`:

```json
{
  "status": true,
  "message": "Logout successful."
}
```

## Error Example

Validation errors use Laravel's standard `422` JSON format:

```json
{
  "message": "The email field is required.",
  "errors": {
    "email": [
      "The email field is required."
    ]
  }
}
```
