TGViewer
Coding Interview Preparation Coding Interview Preparation @coding_interview_preparation · 5.9K subscribers
Post #1200 613
✅ Authentication & Security – Web Development Interview Questions & Answers 🔐🛡️

1️⃣ What is the difference between Authentication and Authorization? 
Answer: 

- Authentication verifies who the user is (e.g., login). 
- Authorization controls what the user can access (e.g., admin vs user access).

2️⃣ What is JWT (JSON Web Token)?
Answer:

A compact token used for stateless authentication. It contains a header, payload (user info), and signature to verify data integrity.

3️⃣ How is JWT more secure than traditional sessions?
Answer:

JWTs are stored on the client-side and signed with a secret. Unlike sessions, they don’t require server-side storage, making them scalable and tamper-evident.

4️⃣ What's the difference between Cookies and LocalStorage?
Answer: 

- Cookies: Automatically sent with each HTTP request, smaller in size, can be HttpOnly. 
- LocalStorage: Larger, persists longer, not sent with requests (manual access only).

5️⃣ What is CORS? Why is it important?
Answer:

CORS (Cross-Origin Resource Sharing) is a browser mechanism that restricts requests from different origins. It protects against unwanted cross-site access.

6️⃣ What is CSRF and how do you prevent it?
Answer:

CSRF (Cross-Site Request Forgery) tricks a logged-in user into submitting unwanted actions. 
Prevention: Use CSRF tokens, SameSite cookies, and avoid storing sensitive data in localStorage.

7️⃣ What is XSS and how do you prevent it? 
Answer: 

XSS (Cross-Site Scripting) injects malicious scripts into web pages. 
Prevention:  Escape user input, use Content Security Policy (CSP), and sanitize HTML.

8️⃣ What is HTTPS and why is it critical?
Answer: 

HTTPS encrypts data using SSL/TLS. It ensures data privacy, integrity, and trust between client and server.

9️⃣ How do you implement password security in web apps? 
Answer: 
- Store hashed passwords using bcrypt or Argon2 
- Use salting 
- Enforce strong password rules 
- Implement rate-limiting on login attempts 

🔟 What is OAuth?
Answer: 

OAuth is an authorization protocol that allows users to grant access to third-party apps without sharing credentials (e.g., login with Google/Facebook).

💬 Tap ❤️ if you found this useful!
  • ❤ 1
More from @coding_interview_preparation
  1. Oct 12, 2026Java Coding Interview Questions Easy 1. Reverse a string without using a built-in reverse…
  2. Oct 10, 2026100 SQL interview questions
  3. Oct 8, 2026If you're prepping for system design interviews, this repo is gold It contains a curated,…
  4. Oct 6, 2026document post
  5. Oct 4, 2026💼 Why Your Resume Gets Rejected Before a Human Reads It You may have good skills and proj…
  6. Oct 2, 2026🧠 Coding Myths You Should Stop Believing There's a lot of advice online about learning to…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →