DRF JWT Token with Mobile

66 views
Skip to first unread message

Mukul Mantosh

unread,
Dec 28, 2017, 3:10:28 AM12/28/17
to Django users
How to get JWT Token in DRF using only mobile number as the parameter instead of email and password..

Krishnasagar Subhedarpage

unread,
Dec 28, 2017, 7:52:07 AM12/28/17
to django...@googlegroups.com, mukulma...@gmail.com
Can you elaborate question? Please add some background for it.
---
Krishnasagar



On Thu, Dec 28, 2017 at 1:40 PM, Mukul Mantosh <mukulma...@gmail.com> wrote:
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 to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1b3ae8bb-2039-4aa9-8a9f-2c4ddb2ffc55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mukul Mantosh

unread,
Dec 28, 2017, 11:25:20 PM12/28/17
to Django users
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 the JWT Token using only mobile number. 
$ curl -X POST -d "mobile=1234567890" http://localhost:8000/api-token-auth/

Normally JWT works with the combination of username and password but i want the token using the mobile number only.


On Thursday, December 28, 2017 at 6:22:07 PM UTC+5:30, Krishnasagar Subhedarpage wrote:
Can you elaborate question? Please add some background for it.
---
Krishnasagar
On Thu, Dec 28, 2017 at 1:40 PM, Mukul Mantosh <mukulma...@gmail.com> wrote:
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 to django-users...@googlegroups.com.

Andréas Kühne

unread,
Dec 29, 2017, 1:22:41 AM12/29/17
to django...@googlegroups.com
Hi,

You will have to implement your own authentication backend to make that work.

See here for an example:

Regards,

Andréas

To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Avraham Serour

unread,
Dec 29, 2017, 6:04:34 AM12/29/17
to django-users
instead of:
curl -X POST -d "mobile=1234567890" http://localhost:8000/api-token-auth/

could you just use:
curl -X POST -d "username=1234567890" http://localhost:8000/api-token-auth/

In any case what's the use case here? This doesn't seem secure at all, to log in someone only using the username, even more using a public know information

Reply all
Reply to author
Forward
0 new messages