Skip to content

Commit

Permalink
Fix dj rest auth response jwt with expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
huynguyengl99 committed Jan 19, 2024
1 parent db414d6 commit 943b70e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drf_spectacular/contrib/rest_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@ def get_token_serializer_class():

if get_version_tuple(__version__) < (3, 0, 0):
use_jwt = getattr(settings, 'REST_USE_JWT', False)
jwt_return_expiration = False

Check warning on line 31 in drf_spectacular/contrib/rest_auth.py

View check run for this annotation

Codecov / codecov/patch

drf_spectacular/contrib/rest_auth.py#L31

Added line #L31 was not covered by tests
else:
from dj_rest_auth.app_settings import api_settings

use_jwt = api_settings.USE_JWT
jwt_return_expiration = api_settings.JWT_AUTH_RETURN_EXPIRATION

if use_jwt:
return get_dj_rest_auth_setting('JWTSerializer', 'JWT_SERIALIZER')
if jwt_return_expiration:
return get_dj_rest_auth_setting('JWTSerializer', 'JWT_SERIALIZER_WITH_EXPIRATION')

Check warning on line 40 in drf_spectacular/contrib/rest_auth.py

View check run for this annotation

Codecov / codecov/patch

drf_spectacular/contrib/rest_auth.py#L40

Added line #L40 was not covered by tests
else:
return get_dj_rest_auth_setting('JWTSerializer', 'JWT_SERIALIZER')
else:
return get_dj_rest_auth_setting('TokenSerializer', 'TOKEN_SERIALIZER')

Expand Down

0 comments on commit 943b70e

Please sign in to comment.