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
{{ message }}
This repository was archived by the owner on May 26, 2020. It is now read-only.
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:
from rest_framework_jwt.views import refresh_jwt_token
105
+
# ...
106
+
107
+
urlpatterns = [
108
+
# ...
109
+
url(r'^api-token-refresh/', refresh_jwt_token),
110
+
]
105
111
```
106
112
107
113
Pass in an existing token to the refresh endpoint as follows: `{"token": EXISTING_TOKEN}`. Note that only non-expired tokens will work. The JSON response looks the same as the normal obtain token endpoint `{"token": NEW_TOKEN}`.
@@ -120,7 +126,14 @@ In some microservice architectures, authentication is handled by a single servic
120
126
121
127
This setup is supported in this package using a verification endpoint. Add the following URL pattern:
from rest_framework_jwt.views import verify_jwt_token
130
+
131
+
#...
132
+
133
+
urlpatterns = [
134
+
# ...
135
+
url(r'^api-token-verify/', verify_jwt_token),
136
+
]
124
137
```
125
138
126
139
Passing a token to the verification endpoint will return a 200 response and the token if it is valid. Otherwise, it will return a 400 Bad Request as well as an error identifying why the token was invalid.
0 commit comments