You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mock Authentication API for Developers - Create and manage mock authentication servers to test your clients in development.
AuthMocker lets you spin up fully-functional mock auth endpoints in seconds. Configure the authentication type, create multiple credentials with custom profiles, set up endpoints with mock responses, and test your client applications without needing a real auth server.
Controllers are thin - they only handle request validation (FormRequest) and response formatting (Resource). Zero business logic.
Services contain all business logic. Authentication mock handling uses the Strategy Pattern with a dedicated strategy for each auth type.
Multi-Credential Model: Server-level config (algorithm, TTLs, key location) is separated from credential-level config (username/password, API keys, client secrets). Each server supports N credentials with custom user profiles.
HasCache Trait provides reusable cache methods across services. Cache is automatically invalidated on create/update/delete operations.
User isolation is enforced at the service layer - queries are always scoped by user_id.
Choose an auth type, give it a name and slug. The slug determines your mock URL: /mock/{slug}/.... A default credential is created automatically.
3. Add credentials
Go to the Credentials tab on your server to create multiple users or clients. Each credential has:
Label: Friendly name (e.g., "Admin User", "Read-Only Client")
Credentials: Auth-type specific data (username/password, API key, client_id/secret, etc.)
Profile: Identity data included in tokens/responses (name, email, role, custom claims)
4. Add endpoints
Configure endpoints with:
HTTP method (GET, POST, PUT, PATCH, DELETE)
Path (e.g., users, products/1)
Response status code
Response body (JSON)
Optional delay (simulate latency)
5. Test your client
# API Key example
curl http://localhost:8080/mock/my-api/users \
-H "X-API-Key: your-configured-key"# JWT example - get token for a specific user
curl -X POST http://localhost:8080/mock/my-api/token \
-d '{"sub": "admin"}'# Then use the token (includes the user's profile in claims)
curl http://localhost:8080/mock/my-api/users \
-H "Authorization: Bearer <token>"# OAuth2 - client credentials (per-client scopes)
curl -X POST http://localhost:8080/mock/my-api/token \
-d "grant_type=client_credentials&client_id=xxx&client_secret=yyy"