From 8f90a1252489a691c35786324a4c3ed75a824d76 Mon Sep 17 00:00:00 2001 From: Benard18 Date: Wed, 15 May 2019 15:02:41 +0300 Subject: [PATCH] This is just a simple update on the knox authentication where the token created is a tuple consisting of a token and instance variable. This prevents the token to be serialized.Here is the update --- rest_social_auth/serializers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest_social_auth/serializers.py b/rest_social_auth/serializers.py index ff5349f..6aacbc0 100644 --- a/rest_social_auth/serializers.py +++ b/rest_social_auth/serializers.py @@ -47,11 +47,12 @@ class KnoxSerializer(TokenSerializer): def get_token(self, obj): try: from knox.models import AuthToken + from knox.settings import knox_settings except ImportError: warnings.warn('django-rest-knox must be installed for Knox authentication', ImportWarning) raise - token = AuthToken.objects.create(obj) + instance, token = AuthToken.objects.create(obj,knox_settings.TOKEN_TTL) return token