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/json

Body

{
  "email": "user@example.com",
  "password": "yourpassword"
}
FieldTypeRequiredDescription
emailstringUser email address
passwordstringUser password

Response

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expiresIn": 86400
}
FieldTypeDescription
tokenstringSigned JWT — include as Authorization: Bearer <token>
expiresInnumberToken TTL in seconds (24 hours)

Error Responses

StatusBodyReason
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...