[Answered ]-How to refresh token after expiry in django knox authentication?

1👍

What worked for me is:

#setting.py

REST_KNOX = {
   'TOKEN_TTL': timedelta(hours=10), #time to live (without refresh)
   'TOKEN_LIMIT_PER_USER': None,
   'AUTO_REFRESH': True,
   'MIN_REFRESH_INTERVAL': 60 #number of seconds
}

You can of course change the settings. If you don’t specify the 'MIN_REFRESH_INTERVAL' it doesn’t work.
The advantage of knox IMOP is that the token refresh is done automatically, and you don’t have to do it yourself (unlike JWT, where you need to specifically ask for a new token with the refresh token).
It’s less secure than JWT. But the plus is that you have less work to do on the client side.

Leave a comment