What is the main purpose of the JWT strategy in a NestJS application?
easy📝 Conceptual Q11 of 15
NestJS - Authentication
What is the main purpose of the JWT strategy in a NestJS application?
ATo encrypt user passwords before saving to the database
BTo manage database connections securely
CTo verify user identity by checking the JWT token in requests
DTo serve static files like images and CSS
Step-by-Step Solution
Solution:
Step 1: Understand JWT strategy role
The JWT strategy is used to check the user's identity by verifying the token sent with requests.
Step 2: Compare options with JWT purpose
Only To verify user identity by checking the JWT token in requests matches this purpose; others relate to different concerns like encryption or static files.
Final Answer:
To verify user identity by checking the JWT token in requests -> Option C
Quick Check:
JWT strategy = verify token [OK]
Quick Trick:JWT strategy always verifies tokens to identify users [OK]
Common Mistakes:
Confusing JWT strategy with password encryption
Thinking JWT handles static file serving
Mixing JWT with database connection management
Master "Authentication" in NestJS
9 interactive learning modes - each teaches the same concept differently