cURL
curl --request POST \ --url https://api.example.com/api/auth/login \ --header 'Content-Type: application/json' \ --data ' { "email": "<string>", "password": "<string>" } '
{ "success": true, "message": "<string>", "data": { "data.User": { "data.User.email": "<string>", "data.User.role": "<string>", "data.User.profile": {}, "data.User.invitedBy": "<string>", "data.User.isProfileComplete": true, "data.User.createdAt": "<string>" }, "data.token": "<string>" } }
Authenticate a user and receive a JWT token
POST /api/auth/login
curl -X POST https://api.yourchurch.com/api/auth/login \ -H "Content-Type: application/json" \ -d '{ "email": "[email protected]", "password": "securePassword123" }'
{ "success": true, "message": "Login Successful", "data": { "User": { "email": "[email protected]", "role": "member", "profile": { "name": "John Doe", "phoneNumber": "+1234567890", "address": "123 Church St" }, "invitedBy": "[email protected]", "isProfileComplete": true, "createdAt": "2024-01-15T10:30:00.000Z" }, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." } }
{ "success": false, "message": "Log in not Successful", "data": "Incorrect Email or Password" }
{ "success": false, "message": "Log in not Successful", "data": "User with email [email protected] not found" }
{ "success": false, "message": "Login not successful", "data": "Error details" }
curl -X GET https://api.yourchurch.com/api/protected-endpoint \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."