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.

Upvotes: 4

Views: 12721

Answers (1)

Linum
Linum

Reputation: 351

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.

Upvotes: 4

Related Questions