Authentication
Create a new user account
Body
usernamestring · min: 1Required
passwordstring · min: 8Required
Responses
200
User registered successfully
application/json
400
Invalid request
application/json
500
Server error
application/json
post
POST /api/auth/register HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Accept: */*
Content-Length: 37
{
"username": "text",
"password": "text"
}
{
"token": "text",
"permissions": [
"text"
]
}
Login with username and password
Body
usernamestringRequired
passwordstringRequired
Responses
200
Login successful
application/json
401
Invalid credentials
application/json
500
Server error
application/json
post
POST /api/auth/login HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Accept: */*
Content-Length: 37
{
"username": "text",
"password": "text"
}
{
"token": "text",
"permissions": [
"text"
]
}
Returns the current user's authentication status and permissions
Authorizations
Responses
200
Authentication state
application/json
401
Not authenticated
application/json
get
GET /api/auth/state HTTP/1.1
Host: localhost:3000
Authorization: Bearer JWT
Accept: */*
{
"authenticated": true,
"username": "text",
"permissions": [
"text"
]
}
Update current user's username and/or password
Authorizations
Body
newUsernamestring · min: 1Optional
currentPasswordstringOptional
newPasswordstring · min: 8Optional
Responses
200
Profile updated successfully
application/json
400
Invalid request
application/json
401
Invalid credentials
application/json
500
Server error
application/json
put
PUT /api/auth/profile HTTP/1.1
Host: localhost:3000
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 68
{
"newUsername": "text",
"currentPassword": "text",
"newPassword": "text"
}
{
"message": "text",
"token": "text",
"permissions": [
"text"
]
}
Was this helpful?