diff options
| author | Tom Christie | 2013-03-30 15:41:38 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-03-30 15:41:38 +0000 |
| commit | b4945f476c5e18be60429441abc0671bf7b193ec (patch) | |
| tree | a16524b93f1ec4e775c380005cb2b8cf33e90054 /docs/api-guide/authentication.md | |
| parent | 922ee61d8611b41e2944b6503af736b1790abe83 (diff) | |
| parent | 399ac70b831d782b7d774950b59f3b2066ab86f7 (diff) | |
| download | django-rest-framework-b4945f476c5e18be60429441abc0671bf7b193ec.tar.bz2 | |
Merge branch 'master' into resources-routers
Diffstat (limited to 'docs/api-guide/authentication.md')
| -rw-r--r-- | docs/api-guide/authentication.md | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md index 541c6575..0eea31d7 100644 --- a/docs/api-guide/authentication.md +++ b/docs/api-guide/authentication.md @@ -119,6 +119,8 @@ To use the `TokenAuthentication` scheme, include `rest_framework.authtoken` in y ... 'rest_framework.authtoken' ) + +Make sure to run `manage.py syncdb` after changing your settings. You'll also need to create tokens for your users. @@ -140,6 +142,10 @@ Unauthenticated responses that are denied permission will result in an `HTTP 401 WWW-Authenticate: Token +The `curl` command line tool may be useful for testing token authenticated APIs. For example: + + curl -X GET http://127.0.0.1:8000/api/example/ -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b' + --- **Note:** If you use `TokenAuthentication` in production you must ensure that your API is only available over `https` only. @@ -294,7 +300,7 @@ The only thing needed to make the `OAuth2Authentication` class work is to insert The command line to test the authentication looks like: - curl -H "Authorization: Bearer <your-access-token>" http://localhost:8000/api/?client_id=YOUR_CLIENT_ID\&client_secret=YOUR_CLIENT_SECRET + curl -H "Authorization: Bearer <your-access-token>" http://localhost:8000/api/ --- |
