JWT Token

2019-08-21 Thread Mohammad Kokhaee
Hello guys I've created token by JWT and My questions 1-how to access to user information by token ? 2-Is that the Right way and is that secure? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: JWT Token

2019-08-21 Thread Ronit Mishra
Hi, First step is to authenticate and obtain the token. For instance, lets say your endpoint is /api/token, so it'll only accepts POST requests. >> post http://127.0.0.1:8000/api/token/ username=mohammad password=123 You can use cURL, or HTTPie or Python's requests module to test this.. Heck you

Re: JWT Token

2019-08-21 Thread Mohammad Kokhaee
Thanks for your explanation After the user send the token to server What Should I do with the token to access to user id and user name and etc . This is project is mostly like blog web and when the user authenticate API returns just post of this user . I don't know how to reach user information w

Re: JWT Token

2019-08-21 Thread Ronit Mishra
You woulld be having some api/profile endpoint, in your project where user details would be available. Send a post request with access token just like I explained in the previous email and you should get the response with profile details. On Thu, Aug 22, 2019 at 5:13 AM Mohammad Kokhaee wrote: >

Re: JWT Token

2019-08-21 Thread Mohammad Kokhaee
I get that clearly But how to get the Response Sorry I'm new On Thu, Aug 22, 2019, 4:37 AM Ronit Mishra wrote: > You woulld be having some api/profile endpoint, in your project where user > details would be available. Send a post request with access token just like > I explained in the previous

Re: JWT Token

2019-08-21 Thread Suraj Thapa FC
token = request. Meta['HTTP_AUTHORIZATION'] data = {'token' : token} payload_decoded = jwt.decode(token, settings.SECRET_KEY) try: valid_data = VerifyJSONWebTokenSerilaizer().validate(data) user = valid_data['user'] self.request.user = user except: pass On Thu, 22 Aug, 201

return jwt token as json

2017-10-29 Thread Rakhee Menon
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 this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this g

DRF JWT Token with Mobile

2017-12-28 Thread Mukul Mantosh
How to get JWT Token in DRF using only mobile number as the parameter instead of email and password.. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email

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 > "Dj

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-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-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 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: DRF JWT Token with Mobile

2017-12-28 Thread Krishnasagar Subhedarpage
Can you elaborate question? Please add some background for it. --- Krishnasagar On Thu, Dec 28, 2017 at 1:40 PM, Mukul Mantosh wrote: > How to get JWT Token in DRF using only mobile number as the parameter > instead of email and password.. > > -- > You received this message

Re: DRF JWT Token with Mobile

2017-12-28 Thread Mukul Mantosh
Django Rest Framework JWT (http://getblimp.github.io/django-rest-framework-jwt/) as specified that JWT token can be obtained by passing username and password. Example: $ curl -X POST -d "username=admin&password=password123" http://localhost: 8000/api-token-auth/ How to obtain

Re: DRF JWT Token with Mobile

2017-12-28 Thread Andréas Kühne
ork JWT (http://getblimp.github.io/ > django-rest-framework-jwt/) as specified that JWT token can be obtained > by passing username and password. > > Example: > $ curl -X POST -d "username=admin&password=password123" http://localhost: > 8000/api-token-auth/ > &g

Re: DRF JWT Token with Mobile

2017-12-29 Thread Avraham Serour
cles/how-to-implement- > custom-authentication-with-django-rest-framework/ > > Regards, > > Andréas > > 2017-12-29 5:25 GMT+01:00 Mukul Mantosh : > >> Django Rest Framework JWT (http://getblimp.github.io/dja >> ngo-rest-framework-jwt/) as specified that JWT token c

Login and Logout using Django JWT Token

2023-03-05 Thread Themporst Aiden
Am working on a personal project, my plan is to build Mobile App in the future for it. I have already developed the backend api endpoints using Django Rest Framework and JWT. But the challenge now is that how can i consume the rest api endpoints from my same django project. ? I know how to send

not able to implement jwt token using django

2017-10-31 Thread rohit . autosoft
class Login(APIView): SECRET =" demo" 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)

Validate and get the user using the jwt token inside a view

2017-09-14 Thread Robin Lery
I am using django-rest-framework for the REST API and django-rest-framework-jwt for JSON web token authentication. After a successful login, the user is provided with a token. I have found how to verify

Re: Validate and get the user using the jwt token inside a view

2017-09-15 Thread oon arfiandwi
Hi, have you try to use jwt_decode_handler(token)? I found this on utils.py I check the source code of verify token, there's reference to decode handler inside the code. -- sincerely, Oon Arfiandwi On Fri, Sep 15, 2017 at 10:11 AM, Robin Lery wrote: > I am using django-rest-framework

Re: Validate and get the user using the jwt token inside a view

2017-09-15 Thread Robin Lery
Thanks. But that doesn't verify the token. On Fri, Sep 15, 2017 at 6:44 PM, oon arfiandwi wrote: > > Hi, > > have you try to use jwt_decode_handler(token)? > I found this on utils.py > > I check the source code of verify token, > there's reference to decode handler inside the code. > > -- > sinc

Re: Validate and get the user using the jwt token inside a view

2017-09-16 Thread Robin Lery
I was about to that by this from rest_framework_jwt.serializers import VerifyJSONWebTokenSerializer data = {'token': token} valid_data = VerifyJSONWebTokenSerializer().validate(data) user = valid_data['user'] Hope this helps any body like me. On Sat, Sep 16, 2017 at 9:34 AM, Robin Lery wrote: