# Login with Verification Code

> `POST /api/user/auth/login`: User endpoint of the Rone Arena API.

Authenticate the player using a verification code to obtain a JWT and session token. This endpoint completes the account login flow, establishes a secure session, and enables authorized access to user-specific resources.

Request body:
- **role_id**: Player role identifier.
- **zone_id**: Server zone identifier.
- **vc**: Verification code sent to the player via in-game mail, valid 5 mins.

The response includes authentication details:
- **code**: Status code (0 indicates success).
- **data.jwt**: JSON Web Token used for subsequent authenticated requests.
- **data.token**: Session token string.
- **data.roleid**: Player role ID.
- **data.zoneid**: Player zone ID.
- **data.time**: Timestamp of login.
- **data.module, name, email, mobile, open_id**: Metadata fields (may be empty depending on account).

The response confirms successful login and provides the credentials required for accessing other user endpoints.

## Request

`POST https://arena.rone.dev/api/user/auth/login`

### Request body

`application/json`, required

```json
{
  "role_id": 1234567890,
  "zone_id": 1234,
  "vc": 1234
}
```

### Example

```bash
curl -X POST 'https://arena.rone.dev/api/user/auth/login' \
  -H 'Content-Type: application/json' \
  -d '{"role_id": 1234567890, "zone_id": 1234, "vc": 1234}'
```

## Example response

```json
{
  "code": 0,
  "data": {
    "email": "",
    "jwt": "eyJhbGciOiJI...REDACTED",
    "mobile": "",
    "module": "",
    "name": "",
    "open_id": "",
    "roleid": 1234567890,
    "time": 1774975992,
    "token": "MTc3ND...REDACTED",
    "zoneid": 1234
  },
  "msg": "ok"
}
```

## Links

- Try it in the playground: https://arena.rone.dev/web/user/auth/login
- User endpoints: https://arena.rone.dev/web/user.md
- OpenAPI schema: https://arena.rone.dev/api/openapi.json
