This repository was archived by the owner on May 26, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Expand file tree Collapse file tree 4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ $ curl -H "Authorization: JWT <your_token>" http://localhost:8000/protected-url/
62
62
```
63
63
64
64
## Refresh Token
65
- If ` JWT_ALLOW_TOKEN_REFRESH ` is True, issued tokens can be "refreshed" to obtain a new brand token with renewed expiration time. Add a URL pattern like this:
65
+ If ` JWT_ALLOW_REFRESH ` is True, issued tokens can be "refreshed" to obtain a new brand token with renewed expiration time. Add a URL pattern like this:
66
66
``` python
67
67
url(r ' ^ api-token-refresh/' , ' rest_framework_jwt.views.refresh_jwt_token' ),
68
68
```
@@ -101,7 +101,7 @@ JWT_AUTH = {
101
101
' JWT_LEEWAY' : 0 ,
102
102
' JWT_EXPIRATION_DELTA' : datetime.timedelta(seconds = 300 ),
103
103
104
- ' JWT_ALLOW_TOKEN_REFRESH ' : False ,
104
+ ' JWT_ALLOW_REFRESH ' : False ,
105
105
' JWT_REFRESH_EXPIRATION_DELTA' : datetime.timedelta(days = 7 ),
106
106
}
107
107
```
@@ -153,7 +153,7 @@ This is an instance of Python's `datetime.timedelta`. This will be added to `dat
153
153
154
154
Default is ` datetime.timedelta(seconds=300) ` (5 minutes).
155
155
156
- ### JWT_ALLOW_TOKEN_REFRESH
156
+ ### JWT_ALLOW_REFRESH
157
157
Enable token refresh functionality. Token issued from ` rest_framework_jwt.views.obtain_jwt_token ` will have an ` orig_iat ` field. Default is ` False `
158
158
159
159
### JWT_REFRESH_EXPIRATION_DELTA
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ def validate(self, attrs):
49
49
50
50
# Include original issued at time for a brand new token,
51
51
# to allow token refresh
52
- if api_settings .JWT_ALLOW_TOKEN_REFRESH :
52
+ if api_settings .JWT_ALLOW_REFRESH :
53
53
payload ['orig_iat' ] = timegm (
54
54
datetime .utcnow ().utctimetuple ()
55
55
)
Original file line number Diff line number Diff line change 26
26
'JWT_LEEWAY' : 0 ,
27
27
'JWT_EXPIRATION_DELTA' : datetime .timedelta (seconds = 300 ),
28
28
29
- 'JWT_ALLOW_TOKEN_REFRESH ' : False ,
29
+ 'JWT_ALLOW_REFRESH ' : False ,
30
30
'JWT_REFRESH_EXPIRATION_DELTA' : datetime .timedelta (days = 7 ),
31
31
}
32
32
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ class RefreshJSONWebTokenTests(BaseTestCase):
164
164
165
165
def setUp (self ):
166
166
super (RefreshJSONWebTokenTests , self ).setUp ()
167
- api_settings .JWT_ALLOW_TOKEN_REFRESH = True
167
+ api_settings .JWT_ALLOW_REFRESH = True
168
168
169
169
def get_token (self ):
170
170
client = APIClient (enforce_csrf_checks = True )
@@ -253,5 +253,5 @@ def test_refresh_jwt_after_refresh_expiration(self):
253
253
254
254
def tearDown (self ):
255
255
# Restore original settings
256
- api_settings .JWT_ALLOW_TOKEN_REFRESH = \
257
- DEFAULTS ['JWT_ALLOW_TOKEN_REFRESH ' ]
256
+ api_settings .JWT_ALLOW_REFRESH = \
257
+ DEFAULTS ['JWT_ALLOW_REFRESH ' ]
You can’t perform that action at this time.
0 commit comments