From 8583c5597e4435daaca987bfae363d14032b4f4f Mon Sep 17 00:00:00 2001 From: VolkerSchiewe Date: Wed, 15 Apr 2020 10:44:54 +0200 Subject: [PATCH 1/3] Add token endpoints from rest_framework_simplejwt to url config --- dj_rest_auth/urls.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dj_rest_auth/urls.py b/dj_rest_auth/urls.py index d3bfc42..3ff64c6 100644 --- a/dj_rest_auth/urls.py +++ b/dj_rest_auth/urls.py @@ -2,6 +2,7 @@ from dj_rest_auth.views import (LoginView, LogoutView, PasswordChangeView, PasswordResetConfirmView, PasswordResetView, UserDetailsView) from django.conf.urls import url +from django.conf import settings urlpatterns = [ # URLs that do not require a session or valid token @@ -16,3 +17,13 @@ urlpatterns = [ url(r'^password/change/$', PasswordChangeView.as_view(), name='rest_password_change'), ] + +if getattr(settings, 'REST_USE_JWT', True): + from rest_framework_simplejwt.views import ( + TokenRefreshView, TokenVerifyView, + ) + + urlpatterns += [ + url(r'token/verify/$', TokenVerifyView.as_view(), name='token_verify'), + url(r'^token/refresh/$', TokenRefreshView.as_view(), name='token_refresh'), + ] From d882edcf10f2a5c6c537a40b85e1b719a5b015f0 Mon Sep 17 00:00:00 2001 From: Michael <487897+iMerica@users.noreply.github.com> Date: Thu, 16 Apr 2020 00:28:05 -0500 Subject: [PATCH 2/3] Update dj_rest_auth/urls.py Co-Authored-By: Daniele Tricoli --- dj_rest_auth/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dj_rest_auth/urls.py b/dj_rest_auth/urls.py index 3ff64c6..2fc1694 100644 --- a/dj_rest_auth/urls.py +++ b/dj_rest_auth/urls.py @@ -24,6 +24,6 @@ if getattr(settings, 'REST_USE_JWT', True): ) urlpatterns += [ - url(r'token/verify/$', TokenVerifyView.as_view(), name='token_verify'), + url(r'^token/verify/$', TokenVerifyView.as_view(), name='token_verify'), url(r'^token/refresh/$', TokenRefreshView.as_view(), name='token_refresh'), ] From 17e92304977c05c1aae6da4a7d31d5ce8bc28231 Mon Sep 17 00:00:00 2001 From: Michael <487897+iMerica@users.noreply.github.com> Date: Thu, 16 Apr 2020 00:28:14 -0500 Subject: [PATCH 3/3] Update dj_rest_auth/urls.py Co-Authored-By: Daniele Tricoli --- dj_rest_auth/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dj_rest_auth/urls.py b/dj_rest_auth/urls.py index 2fc1694..9c79691 100644 --- a/dj_rest_auth/urls.py +++ b/dj_rest_auth/urls.py @@ -18,7 +18,7 @@ urlpatterns = [ name='rest_password_change'), ] -if getattr(settings, 'REST_USE_JWT', True): +if getattr(settings, 'REST_USE_JWT', False): from rest_framework_simplejwt.views import ( TokenRefreshView, TokenVerifyView, )