Overview
MinistryHub uses JWT (JSON Web Token) based authentication to secure API endpoints. All protected endpoints require a valid JWT token in the request headers.Authentication Flow
- Login: Send credentials to the login endpoint
- Receive Token: Get a JWT access token with 1-hour expiration
- Include Token: Send the token in the
Authorizationheader for all subsequent requests - Token Expiration: Tokens expire after 3600 seconds (1 hour)
Login Endpoint
POST /api/auth/login
Authenticate a user and receive a JWT access token.User’s email address
User’s password
Google reCAPTCHA v3 token for security verification (minimum score: 0.5)
Request Example
Response
Indicates if authentication was successful
JWT token to use for authenticated requests
Token expiration time in seconds (3600 = 1 hour)
Success Response Example
Error Responses
Using the Access Token
Once authenticated, include the JWT token in theAuthorization header of all API requests:
Alternative Token Methods
For Server-Sent Events (SSE) or situations where headers cannot be set:Protected Endpoints
All endpoints except/api/auth/* require authentication. If a token is missing or invalid, you’ll receive:
Security Notes
- Tokens expire after 1 hour
- Store tokens securely (e.g., secure HTTP-only cookies, encrypted storage)
- Never expose tokens in URLs (except for SSE/EventSource use cases)
- reCAPTCHA v3 is required for login attempts
- Password verification uses PHP’s
password_verify()with bcrypt hashing
Next Steps
JWT Token Structure
Learn about JWT payload and token structure
API Reference
Explore available API endpoints