POST, PUT, PATCH, DELETE) do.
Getting a Token
Send aPOST request to /api/auth/login with your credentials in the request body.
Request Body Parameters
Your NodeForgeCMS admin username.
Your NodeForgeCMS admin password.
Login Request
Successful Response
On success, the API returns a200 response containing your JWT token and basic information about the authenticated user:
| Field | Type | Description |
|---|---|---|
data.token | string | The JWT Bearer token to use in subsequent requests |
data.user.id | integer | Unique identifier of the authenticated user |
data.user.username | string | Username of the authenticated user |
data.user.role | string | Role assigned to the user (admin or editor) |
token value securely — you’ll include it in the Authorization header of every authenticated request.
Using the Token
Once you have a token, pass it in theAuthorization header as a Bearer token on every request that requires authentication:
curl Example
YOUR_TOKEN with the full token string returned from the login endpoint. The Bearer prefix (with the trailing space) is required.
Never expose your token in client-side code, public repositories, or logs. Treat it with the same care as a password. If a token is compromised, re-authenticate to obtain a new one.
Token Expiry
Tokens expire after a configured period defined in your NodeForgeCMS server settings. When a token expires, the API will reject it with a401 Unauthorized response:
POST /api/auth/login again with your credentials to obtain a fresh token. There is no refresh-token mechanism — each new session requires a full login.
Error Responses
| Code | Error | Description |
|---|---|---|
401 | Unauthorized | The Authorization header is missing, the token is malformed, or the token has expired. |
403 | Forbidden | The token is valid and the user is authenticated, but the user’s role does not have permission to perform the requested operation. |
401 Example — Missing or Invalid Token
403 Example — Insufficient Permissions
403, check that the authenticated user has the appropriate role for the operation. Certain endpoints — such as user administration — may be restricted to users with the admin role only.