Re: return jwt token as json

2017-11-03 Thread Jani Tiainen
According to pyjwt docs it can be either datetime object or number (unix epoch) https://pyjwt.readthedocs.io/en/latest/usage.html#expiration-time-claim-exp 3.11.2017 9.37 "James Schneider" kirjoitti: > > > On Oct 31, 2017 4:36 AM, "Rakhee Menon" wrote: > > > > class Login(APIView): > >def

Re: return jwt token as json

2017-11-03 Thread James Schneider
if user: payload = { 'id': user.pk, 'username': user.username, 'staff': user.email, 'exp': datetime.utcnow() I think that datetime.utcnow() returns a datetime object, not a string, and I don't think it can be serialized

Re: return jwt token as json

2017-11-03 Thread James Schneider
On Oct 31, 2017 4:36 AM, "Rakhee Menon" wrote: class Login(APIView): def post(self, request, *args, **kwargs): import ipdb;ipdb.set_trace() username = request.POST.get('username') password = request.POST.get('password') user = Person.objects.get(username=username

Re: return jwt token as json

2017-10-31 Thread Rakhee Menon
class Login(APIView): def post(self, request, *args, **kwargs): import ipdb;ipdb.set_trace() username = request.POST.get('username') password = request.POST.get('password') user = Person.objects.get(username=username, password=password) #user = user[0]

Re: return jwt token as json

2017-10-29 Thread Jani Tiainen
As a simplest possible form you can pass jwt as s string: "Xxx.yyyhgg.cxxch" 29.10.2017 19.33 "Rakhee Menon" kirjoitti: > Unable to send jwt token as json response > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from th