Hello, Django Rest Framework logout <https://stackoverflow.com/a/37746229/4511992> Refer following code:
def post(self, request): return self.logout(request) def logout(self, request): try: request.user.auth_token.delete() except (AttributeError, ObjectDoesNotExist): pass logout(request) return Response({"success": _("Successfully logged out.")}, status=status.HTTP_200_OK) On Monday, 14 September, 2020 at 2:44:34 pm UTC+5:30 ashutosh...@gmail.com wrote: > I have created custom user ,through which i have authenticated and got > token .Later the user log in .Now i want to create logout.How can i get > that user token who recently logged in. -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/0eb2db22-b28b-40ca-af42-ec7f4d75c6c2n%40googlegroups.com.