st4lk / django-rest-social-auth

OAuth signin with django rest framework
MIT License
521 stars 122 forks source link

change KnoxSerializer #110

Closed alikomijani closed 4 years ago

alikomijani commented 4 years ago

Hi, when I use knox i get this error :

Object of type 'AuthToken' is not JSON serializable so you must change token value from AuthToken.objects.create(obj) to AuthToken.objects.create(obj)[1] beacause AuthToken return a tuple and you need just token

class KnoxSerializer(TokenSerializer): def get_token(self, obj): try: from knox.models import AuthToken except ImportError: warnings.warn('django-rest-knox must be installed for Knox authentication', ImportWarning) raise token = AuthToken.objects.create(obj)[1] return token

st4lk commented 4 years ago

Fix is published in v4.0.0 now.