The MockX Authentication API is designed to secure your applications by providing robust authentication mechanisms. This includes user login with username and password, token generation for session management, and user profile retrieval post-authentication. Here’s how to utilize these capabilities effectively.
Endpoints Overview
The Authentication API introduces essential endpoints for managing user authentication:
POST /login: Authenticates a user by their username and password.
GET /me: Retrieves the profile of the currently authenticated user.
Authenticate User
Authenticate a user and receive a token for session management.
Body:
username: The user's username.
password: The user's password.
expiresInMins (optional): The desired token expiration time in minutes.
Example Request:
Example Response:
Get Current User Profile
Retrieve the profile of the currently authenticated user using the token provided during login.
Headers:
Authorization: Bearer token
Example Response:
MockX offers free, reliable mock APIs for easy testing and development, ideal for developers seeking to enhance their workflow without the complexities of setting up any server.