feat: implement secure cookie-based authentication with login, refresh, and logout endpoints

This commit is contained in:
Your Name
2026-04-10 18:11:15 +05:30
parent 0d37242f0d
commit 373c2b1815
3 changed files with 53 additions and 6 deletions
+4 -5
View File
@@ -1,18 +1,17 @@
from django.urls import path
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView
from users.views import ActivationView
from .views import MeView, RegisterView
from .views import ActivationView, LogoutView, MeView, RegisterView, TokenLoginView, TokenRefreshView
urlpatterns = [
path("register/", RegisterView.as_view(), name="register"),
# Login and get access and refresh tokens
path("login/", TokenObtainPairView.as_view(), name="token_obtain_pair"),
path("login/", TokenLoginView.as_view(), name="token_obtain_pair"),
# Get a new access token using a refresh token
path("refresh/", TokenRefreshView.as_view(), name="token_refresh"),
# Get current user info
path("me/", MeView.as_view(), name="me"),
# Activate user account
path("activate/<str:uidb64>/<str:token>/", ActivationView.as_view(), name="activate"),
# Logout and delete the access token
path("logout/", LogoutView.as_view(), name="logout"),
]