Our authentication system uses JWT (JSON Web Tokens) for secure user authentication. All protected endpoints require a valid Bearer token in the Authorization header.
Secure, stateless authentication with configurable expiration
Bcrypt hashing and secure password reset functionality
Fine-grained permissions for different user types
Create a new user account with email, username, and password
/api/v1/auth/signup{
"email": "user@example.com",
"password": "securePassword123",
"username": "johndoe"
}curl -X POST "https://api.payment-gateway.com/api/v1/auth/signup" \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "securePassword123",
"username": "johndoe"
}'{
"success": true,
"message": "User registered successfully",
"data": {
"user": {
"id": 1,
"email": "user@example.com",
"username": "johndoe",
"createdAt": "2024-01-15T10:30:00Z"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}Authenticate user with email and password to receive JWT token
/api/v1/auth/login{
"email": "user@example.com",
"password": "securePassword123"
}curl -X POST "https://api.payment-gateway.com/api/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "securePassword123"
}'{
"success": true,
"message": "Login successful",
"data": {
"user": {
"id": 1,
"email": "user@example.com",
"username": "johndoe"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": "24h"
}
}How to include JWT tokens in your API requests
Include the JWT token in the Authorization header for all protected endpoints:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
curl -X GET "https://api.payment-gateway.com/api/v1/protected-endpoint" \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \ -H "Content-Type: application/json"
Important security considerations for your implementation
Store JWT tokens in secure storage (httpOnly cookies or secure local storage)
Always use HTTPS in production to protect token transmission
Implement automatic token refresh before expiration