-
Notifications
You must be signed in to change notification settings - Fork 0
User Authentication Endpoints
POST /register
Registers a new user in the system.
| Field | Type | Required | Description |
|---|---|---|---|
username |
string | Yes | The user's display name. |
email |
string | Yes | The user's email address. |
password |
string | Yes | The user's password. |
language_code |
string | No | Preferred language code (default: en). |
-
201 Created: User registered successfully.
{ "message": "User created successfully" } -
400 Bad Request: Missing required fields or invalid data.
{ "message": "Username, email, and password are required" }{ "message": "Password does not meet security requirements" }{ "message": "User name already exists" }{ "message": "Email already exists" } -
500 Internal Server Error: An unexpected error occurred.
{ "message": "An error occurred during registration" }
POST /login
Authenticates a user and returns access and refresh tokens.
| Field | Type | Required | Description |
|---|---|---|---|
| string | Yes | The user's email address. | |
| password | string | Yes | The user's password. |
-
200 OK: New access token generated.
{ "access_token": "new-access-token" } -
401 Unauthorized: Invalid or expired refresh token.
{ "message": "Invalid token" }
Fetches user data by email for authentication purposes.
Updates the last login timestamp for a given user.
Registers a new user with the provided details.
Validates password strength based on predefined security requirements.
Compares the provided password with the stored hashed password.
Generates a new JWT access token for the user.
Generates a new JWT refresh token for the user.
Extracts the token from the Authorization header.
Verifies the validity of the token and ensures it matches the required type (e.g., refresh or access).
- TokenError: Custom error handling for token-related issues, returning descriptive messages and appropriate status codes.
- MySQLError: Catches database-related errors and maps them to user-friendly messages.
For further questions, contact the development team.