Search code examples
djangodjoser

How long does it take for a Djoser access token until expire?


So Djoser JWT provided an access token when you login, how long until that token expires?


Solution

  • You have to provide the value in the settings. I use the below configuration. 10 minutes is probably better for the access token.

    SIMPLE_JWT = {
        'ACCESS_TOKEN_LIFETIME': timedelta(minutes=5),
        'REFRESH_TOKEN_LIFETIME': timedelta(minutes=360),
    }
    

    Check out the simplejwt docs here https://django-rest-framework-simplejwt.readthedocs.io/en/latest/settings.html#access-token-lifetime