File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 11curl --header "Content-Type: application/json" -X POST http://127.0.0.1:8000/api/token/obtain/ --data '{"username":"djsr","password":"djsr"}'
22curl --header "Content-Type: application/json" -X POST http://127.0.0.1:8000/api/user/create/ --data '{"email":"ichiro@mariners.com","username":"ichiro1","password":"konnichiwa"}'
3- curl --header "Content-Type: application/json" -X POST http://127.0.0.1:8000/api/token/refresh/ --data '{"refresh":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU2MTYyMTg0OSwianRpIjoiYmE3OWUxZTEwOWJkNGU3NmI1YWZhNWQ5OTg5MTE0NjgiLCJ1c2VyX2lkIjoxfQ.S7tDJaaymUUNs74Gnt6dX2prIU_E8uqCPzMtd8Le0VI "}'
3+ curl --header "Content-Type: application/json" -X POST http://127.0.0.1:8000/api/token/refresh/ --data '{"refresh":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU4MzMzMDg5MSwianRpIjoiZTZjN2ZjMzMyNzdiNDMwNzgyNGM1MzQyN2U0ZWU2NmYiLCJ1c2VyX2lkIjoxLCJmYXZfY29sb3IiOiJSb3VnZSJ9.acscYBSt57Crm8TAjOkVScjdJ9tPkdeCkr647p6mTqw "}'
44curl --header "Content-Type: application/json" --header "Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTYwNDI5MTE2LCJqdGkiOiI1NWVlZDA4MGQ2YTg0MzI4YTZkZTE0Mjg4ZjE3OWE0YyIsInVzZXJfaWQiOjIsImZhdl9jb2xvciI6IiJ9.LXqfhFifGDA6Qg8s4Knl1grPusTLX1lh4YKWuQUuv-k" -X GET http://127.0.0.1:8000/api/hello/
Original file line number Diff line number Diff line change 33from rest_framework_simplejwt .views import TokenObtainPairView
44from rest_framework .views import APIView
55from rest_framework_simplejwt .tokens import RefreshToken
6+ from rest_framework_simplejwt .token_blacklist .models import OutstandingToken , BlacklistedToken
67
78from .serializers import MyTokenObtainPairSerializer , CustomUserSerializer
89
@@ -32,6 +33,8 @@ def get(self, request):
3233
3334
3435class LogoutAndBlacklistRefreshTokenForUserView (APIView ):
36+ permission_classes = (permissions .AllowAny ,)
37+ authentication_classes = ()
3538
3639 def post (self , request ):
3740 try :
@@ -40,4 +43,4 @@ def post(self, request):
4043 token .blacklist ()
4144 return Response (status = status .HTTP_205_RESET_CONTENT )
4245 except Exception as e :
43- return Response (status = status .HTTP_400_BAD_REQUEST )
46+ return Response (status = status .HTTP_400_BAD_REQUEST )
You can’t perform that action at this time.
0 commit comments