Skip to content

Commit d243538

Browse files
committed
Note on using curl with token auth
1 parent fb105d1 commit d243538

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/api-guide/authentication.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ To use the `TokenAuthentication` scheme, include `rest_framework.authtoken` in y
119119
...
120120
'rest_framework.authtoken'
121121
)
122+
123+
Make sure to run `manage.py syncdb` after changing your settings.
122124

123125
You'll also need to create tokens for your users.
124126

@@ -140,6 +142,10 @@ Unauthenticated responses that are denied permission will result in an `HTTP 401
140142

141143
WWW-Authenticate: Token
142144

145+
The `curl` command line tool may be useful for testing token authenticated APIs. For example:
146+
147+
curl -X GET http://127.0.0.1:8000/api/example/ -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
148+
143149
---
144150

145151
**Note:** If you use `TokenAuthentication` in production you must ensure that your API is only available over `https` only.

0 commit comments

Comments
 (0)