Bird
0
0

What is the main purpose of the LocalStrategy in NestJS authentication?

easy📝 Conceptual Q11 of 15
NestJS - Authentication
What is the main purpose of the LocalStrategy in NestJS authentication?
ATo encrypt user passwords
BTo generate JWT tokens for users
CTo handle user registration
DTo verify username and password for user login
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of LocalStrategy

    The LocalStrategy is designed to check user credentials, specifically username and password, during login.
  2. Step 2: Differentiate from other strategies

    Unlike JWT or OAuth strategies, LocalStrategy focuses on validating credentials, not token generation or registration.
  3. Final Answer:

    To verify username and password for user login -> Option D
  4. Quick Check:

    LocalStrategy = username/password check [OK]
Quick Trick: Local strategy always checks username and password [OK]
Common Mistakes:
  • Confusing LocalStrategy with JWT token generation
  • Thinking LocalStrategy handles user registration
  • Assuming LocalStrategy encrypts passwords

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes