App Router లో ప్రామాణీకరణ అనేక పొరలను విస్తృతం చేస్తుంది — సెషన్లు, middleware, సర్వర్-సైడ్ చెక్లు మరియు Server Actions సంరక్షణ. ఆధునిక విధానం సర్వర్-సైడ్ సెషన్ ధృవీకరణకు ప్రాధాన్యం ఇస్తుంది క్లయింట్-మాత్రమే చెక్ల కంటే.
సెషన్ వ్యూహం
Cookie-based sessions (httpOnly cookie):
✓ Store a signed session id or encrypted JWT in an httpOnly, secure cookie
✓ httpOnly = not readable by JavaScript → protects against XSS token theft
✓ Use a library: Auth.js (NextAuth), Clerk, Lucia, or a custom solution
1. Middleware లో కఠినమైన గేటింగ్ (వేగవంతమైన, కానీ సంపూర్ణ కథ కాదు)
() {
session = req..()?.;
(req...() && !session) {
.( (, req.));
}
.();
}
