Overview
The MND API uses passwordless magic link authentication. Users receive a secure token via email (simulated in development) that creates a session lasting 7 days.Authentication Flow
Send Magic Link
Request Body
User’s email address. Must be a valid email format.
Response Fields
Indicates if the magic link was generated successfully
User-friendly confirmation message
Development-only fields (removed in production)
Error Responses
Missing Email (400)Verify Magic Link
Query Parameters
Magic link token received via email (valid for 15 minutes)
Response Fields
Indicates if authentication was successful
JWT-style authentication token valid for 7 days. Use this in the Authorization header for protected endpoints.
Authenticated user information
Error Responses
Missing Token (400)Using Auth Tokens
After successful verification, include the auth token in the Authorization header:Example Protected Request
Get User Profile
Headers
Bearer token obtained from verification endpoint
Logout
Token Lifecycle
Magic Link Token
- Generated: On POST /api/auth/send-link
- Expires: 15 minutes
- Single Use: Cannot be reused after verification
- Storage: Server-side in users.json
Auth Token
- Generated: On successful magic link verification
- Expires: 7 days
- Revocation: Explicit logout or expiration
- Storage: Server-side in users.json
Automatic Cleanup
Expired tokens are automatically removed:- When new magic links are generated
- During token validation
Security Considerations
Protected Endpoints
The following endpoints require authentication:GET /api/favoritesPOST /api/favoritesPUT /api/favorites/:idDELETE /api/favorites/:id