Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Add authtoken auth using django_rest framework #266

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

claudyus
Copy link
Member

@claudyus claudyus commented Oct 9, 2015

Here a one-line patch from @cvalenti that allow the users to query api using auth token.

To generate a token (coder way):

from rest_framework.authtoken.models import Token
from django.contrib.auth import get_user_model
User = get_user_model()
user = User.objects.get(username='admin')
token = Token.objects.create(user=user_admin)
print token.key

to use it:

curl -X GET <url> -H 'Authorization: Token <token_id>' | python -m json.tool

INVESTIGATION NEEDED: @cvalenti, @nemesisdesign How to generate auth token from admin interface?
Q: Where this should be documented?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants