M
M
MalikDeveloper20772020-08-29 18:32:23
JSON Web Token
MalikDeveloper2077, 2020-08-29 18:32:23

DRF Simple JWT. How to add access and refresh token EXPIRE TIME to response data?

## In urls.py

from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)

urlpatterns = [
    ...
    path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    ...
]


Then when I request api/token/ I got a json response with only access tokens and refoesh.
But I need to also get access token expiration time to store it in localStorage and request refresh url store new access token in storage if it has expired

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2020-09-01
@tumbler

And the setting in settings is not it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question