django - Refresh jwt in django restframework jwt -
from http://getblimp.github.io/django-rest-framework-jwt/#refresh-token
each time user loads page, can check if there existing non-expired token , if it's close being expired, refresh extend session. in other words, if user actively using site, can keep "session" alive.
can explain me how can implement client-side that?
- define expiration time delta , set in django settings , client-side code.
- authorize app, should receive valid token.
- store token , current timestamp in localstorage.
- then on each page loading (or setinterval schedule) check if delta between timestamp , (use moment.js that) closing expiration value , refresh token if required.
- if token refreshing passed repeat step 3 , 4.
Comments
Post a Comment