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?

  1. define expiration time delta , set in django settings , client-side code.
  2. authorize app, should receive valid token.
  3. store token , current timestamp in localstorage.
  4. then on each page loading (or setinterval schedule) check if delta between timestamp , (use moment.js that) closing expiration value , refresh token if required.
  5. if token refreshing passed repeat step 3 , 4.

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -