B. Missing async keyword before authorize function
C. authorize function should return false instead of null on failure
D. Credentials object keys must be strings, not objects
Solution
Step 1: Review credentials provider syntax
The credentials object correctly defines username and password with label and type.
Step 2: Check authorize function correctness
authorize is async, returns user object on success, null on failure, which is valid.
Final Answer:
No error, configuration is correct -> Option A
Quick Check:
Credentials provider config valid = B [OK]
Hint: authorize returns user or null; credentials keys are objects [OK]
Common Mistakes:
Thinking authorize must return false instead of null
Confusing credentials keys as strings only
Missing async on authorize function
5. You want to configure both GitHub OAuth and custom credentials login in Next.js. Which is the correct way to combine these providers in authOptions?
hard
A. Set providers as an array with GitHubProvider and CredentialsProvider inside, each configured properly
B. Use only one provider at a time; combining causes errors
C. Merge GitHub and Credentials provider objects into one before adding to providers array
D. Add GitHubProvider inside credentials object as a nested provider
Solution
Step 1: Understand multiple provider setup
NextAuth supports multiple providers by listing them in the providers array separately.
Step 2: Avoid incorrect merging or nesting
Providers must be separate objects; merging or nesting causes errors.
Final Answer:
Set providers as an array with GitHubProvider and CredentialsProvider inside, each configured properly -> Option A
Quick Check:
Multiple providers = separate objects in array [OK]
Hint: List each provider separately in the providers array [OK]