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
POST
https://api.lunargroup.dev/auth/registerPublicCreate a user-role account and return a one-time JWT.
Body
usernamestringrequired
3–32 chars matching
^[a-zA-Z0-9_.-]+$.passwordstringrequired
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
POST
https://api.lunargroup.dev/auth/loginPublicValidate credentials, rotate the stored token hash, and return a new bearer token.
Body
usernamestringrequired
The account username.
passwordstringrequired
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" }