Documentation
Learn how to integrate ConnectX into your application.
Login
Learn how to authenticate users in ConnectX
The login endpoint allows users to authenticate and receive JWT tokens for accessing protected resources. The system uses email and password for authentication and requires email verification before allowing login.
- User submits email and password
- System verifies credentials and email verification status
- If verified, system returns:
- Access token (short-lived)
- Refresh token (long-lived)
- User data
- If not verified, system returns error asking to verify email
Login Request
{
"email": "string (required)",
"password": "string (required)"
}Refresh Token Request
{
"refresh": "string (required)"
}Login Response
{
"access": "string (JWT access token)",
"refresh": "string (JWT refresh token)",
"user": {
"id": "UUID",
"name": "string",
"email": "string",
"role": "string",
"is_verified": "boolean",
"tenant": "UUID",
"created_at": "datetime",
"updated_at": "datetime"
}
}Refresh Token Response
{
"access": "string (new JWT access token)"
}Common Errors
- 401 Unauthorized
{ "error": "Invalid credentials" } - 403 Forbidden
{ "error": "Please verify your email address before logging in.", "email": "user@example.com" }
Authenticate a user and get JWT tokens.
Command
curl -X POST 'https://connectx-backend-4o0i.onrender.com/api/auth/login/' \
-H 'Content-Type: application/json' \
-d '{
"email": "user@example.com",
"password": "your_password"
}'Response
{
"access": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
"user": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "John Doe",
"email": "user@example.com",
"role": "customer",
"is_verified": true,
"tenant": "123e4567-e89b-12d3-a456-426614174001",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
}Get a new access token using a refresh token.
Command
curl -X POST 'https://connectx-backend-4o0i.onrender.com/api/auth/refresh/' \
-H 'Content-Type: application/json' \
-d '{
"refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
}'Response
{
"access": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
}