File tree Expand file tree Collapse file tree 3 files changed +22
-9
lines changed Expand file tree Collapse file tree 3 files changed +22
-9
lines changed Original file line number Diff line number Diff line change 3838 models
3939 advanced_topics
4040 settings
41+ management_commands
4142 glossary
4243
4344.. toctree ::
Original file line number Diff line number Diff line change 1+ Management commands
2+ ===================
3+
4+ Django OAuth Toolkit exposes some useful management commands that can be run via shell or by other means (eg: cron)
5+
6+ .. _cleartokens :
7+
8+ cleartokens
9+ ~~~~~~~~~~~
10+
11+ The ``cleartokens `` management command allows the user to remove those refresh tokens whose lifetime is greater than the
12+ amount specified by ``REFRESH_TOKEN_EXPIRE_SECONDS `` settings. It is important that this command is run regularly
13+ (eg: via cron) to avoid cluttering the database with expired refresh tokens.
14+
15+ If ``cleartokens `` runs daily the maximum delay before a refresh token is
16+ removed is ``REFRESH_TOKEN_EXPIRE_SECONDS `` + 1 day. This is normally not a
17+ problem since refresh tokens are long lived.
18+
19+ Note: Refresh tokens need to expire before AccessTokens can be removed from the
20+ database. Using ``cleartokens `` without ``REFRESH_TOKEN_EXPIRE_SECONDS `` has limited effect.
Original file line number Diff line number Diff line change @@ -98,15 +98,7 @@ The name of the *write* scope.
9898REFRESH_TOKEN_EXPIRE_SECONDS
9999~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100100The number of seconds before a refresh token gets removed from the database by
101- the ``cleartokens` `` management command. It's important that ``cleartokens ``
102- runs regularly (eg: via cron) in order for this setting to work.
103-
104- If ``cleartokens `` runs daily the maximum delay before a refresh token is
105- removed is ``REFRESH_TOKEN_EXPIRE_SECONDS `` + 1 day. This is normally not a
106- problem since refresh tokens are long lived.
107-
108- Note: Refresh tokens need to expire before AccessTokens can be removed from the
109- database. Using ``cleartokens `` without ``REFRESH_TOKEN_EXPIRE_SECONDS `` has limited effect.
101+ the ``cleartokens `` management command. Check :ref: `cleartokens ` management command for further info.
110102
111103REQUEST_APPROVAL_PROMPT
112104~~~~~~~~~~~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments