【发布时间】:2018-11-19 12:22:38
【问题描述】:
我已将 JWT 令牌与 django-restframwork 集成,在这里我设置了过期时间 15 分钟 JWT_EXPIRATION_DELTA 但它在提到的时间(1 分钟)之前过期,我需要刷新令牌才能继续...
PFB me 配置
Python 3.5
Django==2.0.5
djangorestframework==3.8.2
djangorestframework-simplejwt==3.2.3
设置.py
REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
],
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework_simplejwt.authentication.JWTAuthentication',
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
)
}
JWT_AUTH = {
'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=900),
'JWT_ALLOW_REFRESH': True,
'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=7),
}
请帮忙,我这里有什么错误吗。
【问题讨论】:
标签: django python-3.x django-rest-framework jwt