Auth routes

Register and log in: POST /auth/register and POST /auth/login, with token rotation behaviour.

Auth routes

Create accounts and obtain bearer tokens. See Authentication for how tokens rotate.

Register

POSThttps://api.lunargroup.dev/auth/registerPublic
Create a user-role account and return a one-time JWT.
Body
username
stringrequired
3–32 chars matching ^[a-zA-Z0-9_.-]+$.
password
stringrequired
The account password.

Request:

{
  "username": "winter_fe",
  "password": "super-secret-password"
}

Response 201:

{
  "user": {
    "id": "user_id",
    "username": "winter_fe",
    "role": "user",
    "banned": false
  },
  "accessToken": "Bearer eyJhbGciOi..."
}

Errors:

{ "error": "Username is required" }
{ "error": "Password is required" }
{ "error": "Unable to sanitize username. Please try again later or report this to WinterFe." }
{ "error": "Username already exists" }
{ "error": "Could not register user" }

Login

POSThttps://api.lunargroup.dev/auth/loginPublic
Validate credentials, rotate the stored token hash, and return a new bearer token.
Body
username
stringrequired
The account username.
password
stringrequired
The account password.

Request:

{
  "username": "winter_fe",
  "password": "super-secret-password"
}

Response 200:

{
  "user": {
    "id": "user_id",
    "username": "winter_fe",
    "role": "user",
    "banned": false
  },
  "accessToken": "Bearer eyJhbGciOi..."
}

Errors:

{ "error": "Username is required" }
{ "error": "Password is required" }
{ "error": "Unable to sanitize username. Please try again later or report this to WinterFe." }
{ "error": "Invalid credentials" }
{ "error": "User is banned" }