aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/api-guide/authentication.md12
-rw-r--r--docs/topics/credits.md3
-rw-r--r--docs/topics/release-notes.md2
3 files changed, 17 insertions, 0 deletions
diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md
index cb1e2645..a30bd22c 100644
--- a/docs/api-guide/authentication.md
+++ b/docs/api-guide/authentication.md
@@ -112,6 +112,18 @@ If you've already created some User`'s, you can run a script like this.
for user in User.objects.all():
Token.objects.get_or_create(user=user)
+When using TokenAuthentication, it may be useful to add a login view for clients to retrieve the token.
+
+REST framework provides a built-in login view for clients to retrieve the token called `rest_framework.authtoken.obtain_auth_token`. To use it, add a pattern to include the token login view for clients as follows:
+
+ urlpatterns += patterns('',
+ url(r'^api-token-auth/', 'rest_framework.authtoken.obtain_auth_token')
+ )
+
+The `r'^api-token-auth/'` part of pattern can actually be whatever URL you want to use. The authtoken login view will render a JSON response when a valid `username` and `password` fields are POST'ed to the view using forms or JSON:
+
+ { 'token' : '9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b' }
+
## OAuthAuthentication
This policy uses the [OAuth 2.0][oauth] protocol to authenticate requests. OAuth is appropriate for server-server setups, such as when you want to allow a third-party service to access your API on a user's behalf.
diff --git a/docs/topics/credits.md b/docs/topics/credits.md
index f037e816..34590109 100644
--- a/docs/topics/credits.md
+++ b/docs/topics/credits.md
@@ -60,6 +60,7 @@ The following people have helped make REST framework great.
* Ben Konrath - [benkonrath]
* Marc Aymerich - [glic3rinu]
* Ludwig Kraatz - [ludwigkraatz]
+* Rob Romano - [robromano]
* Eugene Mechanism - [mechanism]
Many thanks to everyone who's contributed to the project.
@@ -156,4 +157,6 @@ To contact the author directly:
[benkonrath]: https://github.com/benkonrath
[glic3rinu]: https://github.com/glic3rinu
[ludwigkraatz]: https://github.com/ludwigkraatz
+[robromano]: https://github.com/robromano
[mechanism]: https://github.com/mechanism
+
diff --git a/docs/topics/release-notes.md b/docs/topics/release-notes.md
index 2a6fbe83..d43f892f 100644
--- a/docs/topics/release-notes.md
+++ b/docs/topics/release-notes.md
@@ -4,6 +4,8 @@
>
> — Eric S. Raymond, [The Cathedral and the Bazaar][cite].
+* Add convenience login view to get tokens when using `TokenAuthentication`
+
## 2.1.3
**Date**: 16th Nov 2012