iMerica / dj-rest-auth

Authentication for Django Rest Framework
https://dj-rest-auth.readthedocs.io/en/latest/index.html
MIT License
1.63k stars 304 forks source link

JWT_TOKEN_CLAIMS_SERIALIZER not work #498

Closed 5no0p closed 1 year ago

5no0p commented 1 year ago

I create a custom token serializer but dj-rest-auth didn't use it, it is working with rest_framework_simplejwt. this is my setting

REST_FRAMEWORK = {
    "DEFAULT_AUTHENTICATION_CLASSES": (
        "dj_rest_auth.jwt_auth.JWTCookieAuthentication",
        # "rest_framework_simplejwt.authentication.JWTAuthentication",
    )
}

REST_AUTH_SERIALIZERS = {
    "USER_DETAILS_SERIALIZER": "users.api.v1.serializers.UserSerializer",
}

REST_AUTH = {
    "JWT_TOKEN_CLAIMS_SERIALIZER": "users.serializers.CustomTokenSerializer",
    "USE_JWT": True,
    "JWT_AUTH_COOKIE": "access",
    "JWT_AUTH_REFRESH_COOKIE": "refresh",
}
5no0p commented 1 year ago

it is working when I put it in REST_AUTH_SERIALIZERS

REST_AUTH_SERIALIZERS = {
    "USER_DETAILS_SERIALIZER": "users.api.v1.serializers.UserSerializer",
    "JWT_TOKEN_CLAIMS_SERIALIZER": "users.serializers.CustomTokenSerializer",
}