Bird
0
0

You want to allow both JWT and Token authentication in your API. How should you configure authentication_classes?

hard📝 Application Q8 of 15
Django - DRF Advanced Features
You want to allow both JWT and Token authentication in your API. How should you configure authentication_classes?
A[JWTAuthentication, TokenAuthentication]
B[TokenAuthentication]
C[SessionAuthentication]
D[BasicAuthentication]
Step-by-Step Solution
Solution:
  1. Step 1: Understand multiple authentication support

    DRF allows multiple authentication classes in a list to support different methods.
  2. Step 2: Combine JWT and TokenAuthentication

    Include both JWTAuthentication and TokenAuthentication in authentication_classes list.
  3. Final Answer:

    [JWTAuthentication, TokenAuthentication] -> Option A
  4. Quick Check:

    Multiple auth classes = list with both JWT and Token [OK]
Quick Trick: List multiple authentication classes to support both methods [OK]
Common Mistakes:
MISTAKES
  • Using only one authentication class when both needed
  • Confusing SessionAuthentication with token methods
  • Using BasicAuthentication instead of token-based

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes