Skip to main content

AuthRequest

Interface for authentication requests sent to the login and registration endpoints.

Interface Definition

Properties

string
required
The username for authentication. Used for both login and registration.
string
required
The user’s password. Should be transmitted securely over HTTPS.

AuthResponse

Interface for authentication responses received after successful login.

Interface Definition

Properties

string
required
The JWT authentication token used for subsequent API requests. Store this securely in localStorage.
string
required
The type of token, typically “Bearer” for JWT tokens.
string
required
The authenticated user’s username.
string
required
The user’s role in the system. Common values: ROLE_ADMIN, ROLE_USER.

Usage Examples

Login Request

Registration Request

Saving Session Data

Checking User Role

Notes

Always transmit authentication credentials over HTTPS to ensure security.
Store tokens securely and never expose them in console logs in production environments.