Search code examples
djangodjango-rest-frameworkdjango-rest-knox

How can I extend expiry time of Knox-Token


I haven't changed the settings of Knox in my Django app. The default expiry time is 10hours, how can I change this that it won't expiry.


Solution

  • TOKEN_TTL

        REST_KNOX = {
           'TOKEN_TTL': timedelta(hours=10),  # default time 10h
        }
    

    just do

        REST_KNOX = {
           'TOKEN_TTL': None,  # will create tokens that never expire
        }
    

    check the documentation