I'm using
Django==4.0.3
djangorestframework==3.13.1
djangorestframework-simplejwt==5.1.0
djoser==2.1.0
I have used djoser to authenticate, and all works fine. How can add expiration datetime for validation and verification link in Djoser?
I'm using
Django==4.0.3
djangorestframework==3.13.1
djangorestframework-simplejwt==5.1.0
djoser==2.1.0
I have used djoser to authenticate, and all works fine. How can add expiration datetime for validation and verification link in Djoser?
If you are talking about the User Activation Email Link.
A simple answer would be yes and just add the below in your setting.
PASSWORD_RESET_TIMEOUT = 60 # in second
So what is happening is Djoser uses Django password reset functionality while generating and validating the token. So if that is the case Django already has a time out for the password reset value so you can set the above value but one catch is you will get the below error if the token is expired instead of a timeout validation error.
{
"token": [
"Invalid token for given user."
]
}
Tested on my machine and it is working fine. Hope this helps.
SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=5),
'REFRESH_TOKEN_LIFETIME': timedelta(minutes=360),
}
Check out the simplejwt docs : click here