NestJS - AuthenticationWhat will happen if you forget to call `super()` in a custom Passport strategy class extending `PassportStrategy`?AThe strategy will not be registered and cause runtime errorsBThe strategy will work normally without issuesCNestJS will automatically call super() for youDThe application will fail to compileCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand class inheritanceExtending PassportStrategy requires calling super() to initialize base class.Step 2: Consequence of missing super()Without super(), the strategy setup fails causing runtime errors.Final Answer:The strategy will not be registered and cause runtime errors -> Option AQuick Check:Missing super() = runtime error [OK]Quick Trick: Always call super() in constructor of PassportStrategy subclass [OK]Common Mistakes:Assuming NestJS calls super() automaticallyThinking missing super() causes compile errorBelieving strategy works without super()
Master "Authentication" in NestJS9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More NestJS Quizzes Authentication - Protected routes with guards - Quiz 9hard Authentication - Refresh token pattern - Quiz 8hard Database with Prisma - Prisma migrations - Quiz 6medium Database with Prisma - CRUD with Prisma - Quiz 2easy Guards - JWT authentication guard - Quiz 7medium Guards - Combining multiple guards - Quiz 11easy Guards - Role-based guards - Quiz 14medium Interceptors - Response transformation - Quiz 13medium Middleware - Global middleware - Quiz 11easy Pipes - File validation pipe - Quiz 12easy