POST /api/auth/login
Authenticates a user and returns a signed JWT token for accessing protected routes.
Request
POST https://api-nekosinga.vercel.app/api/auth/login
Content-Type: application/jsonBody
{
"email": "user@example.com",
"password": "yourpassword"
}| Field | Type | Required | Description |
|---|---|---|---|
email | string | ✅ | User email address |
password | string | ✅ | User password |
Response
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 86400
}| Field | Type | Description |
|---|---|---|
token | string | Signed JWT — include as Authorization: Bearer <token> |
expiresIn | number | Token TTL in seconds (24 hours) |
Error Responses
| Status | Body | Reason |
|---|---|---|
400 | { "error": "Missing fields" } | email or password not provided |
401 | { "error": "Invalid credentials" } | Wrong email or password |
Using the Token
After login, pass the token in the Authorization header for any protected route:
GET /api/protected-route
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...