انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهJNR-024-L02

الجلسات مقابل الرموز (Tokens)

  • الدرس 2 من 6
  • Junior
في هذا الدرس 4 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

compare the two common ways to stay logged in.

الموضوعات المخطط لها

  • Session: after login the server stores state and gives the client a session ID, usually in a cookie. Each request sends it back.
  • Token: after login the server gives a signed token (for example a JWT) that the client sends in Authorization: Bearer .... The server verifies it without stored state.
  • Sessions are simple to revoke but need shared storage when you run several instances.
  • Tokens scale easily across instances but are harder to revoke before they expire.
  • Browser apps often use cookie sessions; mobile apps and APIs often use tokens. JNR-P5 implements them.
تفاصيل المخطط المبدئي

عرض عملي

text
Session: Cookie: JSESSIONID=abc123
Token:   Authorization: Bearer eyJhbGciOi...

اختبر فهمك

Which approach keeps state on the server?

أظهر الإجابة

Sessions.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.