[Django]-Add expire time for validation and verification in Djoser

0๐Ÿ‘

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.

๐Ÿ‘คChapi Menge

-1๐Ÿ‘

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

}

Check out the simplejwt docs : click here

๐Ÿ‘คcarmel26

Leave a comment