1 from django.utils.timezone import now
2 from rest_framework.authentication import TokenAuthentication as BaseTokenAuthentication
6 class TokenAuthentication(BaseTokenAuthentication):
9 def authenticate_credentials(self, key):
10 user, token = super().authenticate_credentials(key)
11 token.last_seen_at = now()
12 token.save(update_fields=['last_seen_at'])