In a microservices architecture, every service shouldn't independently validate JWTs — it's expensive, error-prone, and creates tight coupling. You'll build an Auth Gateway that:
1. Sits between the API Gateway and backend services
2. Validates the JWT once
3. Extracts user claims and creates a passport (a base64-encoded JSON blob)
4. Attaches the passport as an X-Passport header to all downstream requests
5. Downstream services trust the passport without re-validating
Endpoints
- POST /v1/auth/signup — Hash password with bcrypt, generate JWT, support idempotency keys
- POST /v1/auth/login — Verify credentials, return JWT
- ANY /v1/proxy/*path — Validate JWT, create passport, proxy to upstream