Skip to content

Commit be7657c

Browse files
author
Carlton Gibson
authored
Merge pull request #5328 from andreagrandi/update-token-docs
Add documentation to create user token with the new command
2 parents e80b78d + 1799b56 commit be7657c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/api-guide/authentication.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,21 @@ It is also possible to create Tokens manually through admin interface. In case y
222222
TokenAdmin.raw_id_fields = ('user',)
223223

224224

225+
#### Using Django manage.py command
226+
227+
Since version 3.6.4 it's possible to generate a user token using the following command:
228+
229+
./manage.py drf_create_token <username>
230+
231+
this command will return the API token for the given user, creating it if it doesn't exist:
232+
233+
Generated token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b for user user1
234+
235+
In case you want to regenerate the token (for example if it has been compromised or leaked) you can pass an additional parameter:
236+
237+
./manage.py drf_create_token -r <username>
238+
239+
225240
## SessionAuthentication
226241

227242
This authentication scheme uses Django's default session backend for authentication. Session authentication is appropriate for AJAX clients that are running in the same session context as your website.

0 commit comments

Comments
 (0)