Cookie
الكوكي (Cookie)
GLS-000103
Definition
A small piece of data stored in the browser that is automatically sent to the server with every request.
قطعة صغيرة من البيانات مخزّنة في المتصفح تُرسَل تلقائيًا إلى الخادم مع كل طلب.
Why It Matters
Firebase Admin SDK in Next.js Middleware reads a session cookie to verify the user on every server-rendered page request.
Firebase Admin SDK في Next.js Middleware يقرأ كوكي الجلسة للتحقق من المستخدم في كل طلب صفحة مُصيَّرة من الخادم.
Full Definition
Example Usage
“After login, 404Fault sets a secure HttpOnly cookie containing the Firebase ID token. Middleware reads this cookie to check auth on every request.”
“بعد تسجيل الدخول، يضع 404Fault كوكي آمنًا HttpOnly يحتوي على رمز Firebase ID. Middleware يقرأ هذا الكوكي للتحقق من المصادقة في كل طلب.”
AI Builder Tips
Avoid these mistakes when using Cookie:
Storing auth tokens in localStorage (vulnerable to XSS)
Missing SameSite=Strict or Lax on auth cookies (enables CSRF)
Sign in to unlock guided AI explanations from AI Teacher.
Generate a Prompt
Copy this prompt and use it directly with any AI model — no setup needed.
Help me build a project using Cookie. Explain: 1. What is Cookie and why it matters 2. The core architecture and required tools 3. Step-by-step implementation plan 4. Common mistakes to avoid: Storing auth tokens in localStorage (vulnerable to XSS), Missing SameSite=Strict or Lax on auth cookies (enables CSRF) 5. Best practices and production tips