Bird
0
0

Which method in a NestJS LocalStrategy class is responsible for validating user credentials?

easy📝 Conceptual Q2 of 15
NestJS - Authentication
Which method in a NestJS LocalStrategy class is responsible for validating user credentials?
Aauthenticate()
Bvalidate()
Cauthorize()
Dlogin()
Step-by-Step Solution
Solution:
  1. Step 1: Identify the validation method in LocalStrategy

    The validate() method is the standard method used to check username and password correctness.
  2. Step 2: Exclude other method names

    Methods like authenticate(), authorize(), and login() are not part of the LocalStrategy class by default.
  3. Final Answer:

    validate() -> Option B
  4. Quick Check:

    Validation method = validate() [OK]
Quick Trick: Use validate() to check credentials in LocalStrategy [OK]
Common Mistakes:
  • Using authenticate() instead of validate()
  • Confusing authorize() with validation
  • Assuming login() is part of LocalStrategy

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes