Skip to content

Commit

Permalink
Installed and configured SimpleJWT
Browse files Browse the repository at this point in the history
  • Loading branch information
someonebear committed Nov 30, 2024
1 parent 4a4e868 commit 0236b0a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
12 changes: 12 additions & 0 deletions server/api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@
else []
)

# SimpleJWT configuration

REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_simplejwt.authentication.JWTAuthentication',
)
}

# Change this to point to custom user model
# AUTH_USER_MODEL = "myapp.CustomUser"

# Application definition

Expand All @@ -52,6 +62,8 @@
"rest_framework",
"corsheaders",
"api.healthcheck",
# For localisations/translations
"rest_framework_simplejwt",
]

MIDDLEWARE = [
Expand Down
6 changes: 6 additions & 0 deletions server/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@
from django.contrib import admin
from django.urls import path, include

from rest_framework_simplejwt.views import (
TokenObtainPairView,
TokenRefreshView,
)
urlpatterns = [
path("admin/", admin.site.urls),
path("api/healthcheck/", include(("api.healthcheck.urls"))),
path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
]
45 changes: 43 additions & 2 deletions server/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ freezegun = "^1.5.1"
gunicorn = "^22.0.0"
python-dotenv = "^1.0.1"
django-extensions = "^3.2.3"
djangorestframework-simplejwt = "^5.3.1"


[tool.poetry.group.dev.dependencies]
Expand Down

0 comments on commit 0236b0a

Please sign in to comment.