Django oauth2 encrypt password

22 views
Skip to first unread message

Shekar Tippur

unread,
Apr 30, 2015, 7:08:05 AM4/30/15
to django...@googlegroups.com
Hello,

I am having trouble with creating a user with encrypted password.

I am able to create a user with the call

curl -H "Authorization: Bearer lXbYKZqnPeqOyYaHyB3EOAvcMny13j" -X POST -d"username=foo1&password=bar1&first_name=foo1&email=fo...@screens.com" http://${endpoint}/users/

{"id":30,"password":"bar1","last_login":null,"is_superuser":false,"username":"foo1","first_name":"foo1","last_name":"","email":"fo...@screens.com","is_staff":false,"is_active":true,"date_joined":"2015-04-30T07:26:00.857445Z","groups":[],"user_permissions":[]}(env)

As you can see, it is creating a new user but the password is in clear text.

As a result, I am unable to get a user token

curl  -X POST -d "grant_type=password&username=foo1&password=bar1&scope=read" -u"${clientid}:${clientsecret}" http://${endpoint}/o/token/

{"error_description": "Invalid credentials given.", "error": "invalid_grant"}(env)

I sort of found a workaround. I can go in as admin to the console and change the user password manually. This seem to store the password as encrypted. How do I sole this via api calls?

I am sure I am missing something. Appreciate if someone could unblock me.

- Shekar

Reply all
Reply to author
Forward
0 new messages