Merge pull request #39 from VolkerSchiewe/master

Add token endpoints from rest_framework_simplejwt to url config
This commit is contained in:
Michael 2020-04-16 21:05:27 -05:00 committed by GitHub
commit 5d2e83c3e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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', False):
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'),
]