Authentication Mock
Mock authentication and authorization in moclojer - JWT tokens, OAuth flows, API keys, and role-based access control. Test auth without real identity providers.
📋 What You'll Build
🔐 JWT Token Simulation
Login Endpoint
- endpoint:
method: POST
path: /api/auth/login
response:
status: 200
headers:
Content-Type: application/json
body: >
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ7e2pzb24tcGFyYW1zLmVtYWlsfX0iLCJpYXQiOjE2NDAwMDAwMDB9.mock_signature",
"user": {
"id": 123,
"email": "{{json-params.email}}",
"name": "{{json-params.name}}",
"role": "user"
},
"expires_in": 3600
}Protected Endpoint
Unauthorized Response
🔑 API Key Authentication
🌐 OAuth 2.0 Flow
Authorization Endpoint
Token Exchange
👥 Role-Based Access Control
Admin Endpoint
🧪 Complete Auth Flow Example
🚀 Testing Examples
✅ Best Practices
📚 See Also
Last updated
Was this helpful?