You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api-guide/authentication.md
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -222,6 +222,21 @@ It is also possible to create Tokens manually through admin interface. In case y
222
222
TokenAdmin.raw_id_fields = ('user',)
223
223
224
224
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
+
225
240
## SessionAuthentication
226
241
227
242
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