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.));
}
.();
}
