Make *** cookie client-accessible & validate OTK directly in Next.js

Otherkamo-internal
Shipped
October 14, 2025 at 3:35 AM UTC
Author
snadjafinia
Commit
d7f7923

Major Simplifications: - *** cookie is now client-accessible (httpOnly: false) - Both Next.js and Java can read the cookie directly - Cookie expires in 30 minutes (matches Redis TTL) OTK Validation (Direct Redis): - Next.js /api/validate now validates OTK directly from Redis - No SecurityService call needed for validation - Fetches *** ID from Redis (key: OTK<otkId>) - Deletes OTK after retrieval (one-time use) - Sets *** cookie for the domain useUserInfo Hook: - Now checks for *** cookie client-side first - If no cookie, skips API call (user not authenticated) - If cookie exists, fetches user info from /api/user-info Benefits: - Eliminates extra API call to SecurityService - Simpler architecture (fewer network hops) - Faster validation (direct Redis access) - Both frontend and backend can access session ID

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing