ifixkart-admin/docs/authentication/customer-auth.md
Adithiyan bbd3a3e959 feat: initial commit — full platform snapshot
- Backend: FastAPI app with all models, services, schemas, routes
- Admin Panel: Next.js dashboard with all modules
  (CRM, POS, repairs, warranties, billing, notifications, etc.)
- Ecommerce: storefront (submodule) + product catalog
- AI Agents: .agents/ skill library for Antigravity IDE
- Docs: architecture, billing, notification gateway markdown
- Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
2026-10-13 12:59:47 +05:30

1.2 KiB

Customer Authentication Architecture

Overview

Customer authentication is managed via CustomerAuthRouter.py, supporting both email/password login and Google OAuth 2.0. Authentication issues short-lived JWT Access Tokens and long-lived Refresh Tokens.


Token & Session Strategy

Access Token: JWT (RS512 signed), 15-minute expiration
Refresh Token: ULID-based opaque token stored in Redis/MySQL, 120-day expiration

Authentication Endpoints

  • POST /api/v1/customer/auth/register - Create customer account.
  • POST /api/v1/customer/auth/login - Authenticate via email/password.
  • POST /api/v1/customer/auth/google - Authenticate via Google OAuth code.
  • POST /api/v1/customer/auth/refresh - Rotate access token.
  • POST /api/v1/customer/auth/logout - Revoke refresh token.

Session Lifecycle & Anonymous Cart Merge

Upon successful authentication (either via email or Google OAuth):

  1. The backend inspects the request for an anonymous visitor_id header or cookie.
  2. If an anonymous cart exists in Redis/MySQL associated with visitor_id, its items are merged into the customer's account cart.
  3. The anonymous cart is marked merged or expired.