Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set token expiration time when using django-rest-authtoken?

I'm using the django-rest-authtoken library (https://github.com/wichmannpas/django-rest-authtoken) to manage my API users. The biggest inconvenience is that the user authentication tokens expire in 24 hours, effectively requiring to perform login every day. Unfortunately I couldn't find a way to change the token expiration time. Any help appreciated.

like image 820
Sandro Tarkhan-Mouravi Avatar asked Oct 25 '25 17:10

Sandro Tarkhan-Mouravi


1 Answers

Looks like 1 day is default value in settings:

https://github.com/wichmannpas/django-rest-authtoken/blob/master/rest_authtoken/settings.py#L10

so setting AUTH_TOKEN_VALIDITY in your project should do the job.

like image 186
Linum Avatar answered Oct 27 '25 06:10

Linum