I am currently using Django Rest Framework to serve a React JS application, but recently, we are adding support for a React Native application as well.
Now, as I use Django Simple jwt, here's the code for the expiry of the refresh and access tokens:
settings.py
ACCESS_TOKEN_LIFETIME = datetime.timedelta(hours=2)
REFRESH_TOKEN_LIFETIME = datetime.timedelta(days=3)
SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': ACCESS_TOKEN_LIFETIME,
'REFRESH_TOKEN_LIFETIME': REFRESH_TOKEN_LIFETIME,
...
}
While this works really well on web, I do not want the phone app users to have to get logged out automatically every 3 days.
Is there a way to alter the refresh token lifetime based on the device that is asking for the tokens?
If yes, how?