Add token endpoints from rest_framework_simplejwt to url config

This commit is contained in:
VolkerSchiewe 2020-04-15 10:44:54 +02:00
parent 40125b15c4
commit 8583c5597e

View File

@ -2,6 +2,7 @@ from dj_rest_auth.views import (LoginView, LogoutView, PasswordChangeView,
PasswordResetConfirmView, PasswordResetView, PasswordResetConfirmView, PasswordResetView,
UserDetailsView) UserDetailsView)
from django.conf.urls import url from django.conf.urls import url
from django.conf import settings
urlpatterns = [ urlpatterns = [
# URLs that do not require a session or valid token # URLs that do not require a session or valid token
@ -16,3 +17,13 @@ urlpatterns = [
url(r'^password/change/$', PasswordChangeView.as_view(), url(r'^password/change/$', PasswordChangeView.as_view(),
name='rest_password_change'), 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'),
]