code: def authenticate_credentials(self, token):
          '''
          Due to the random nature of hashing a salted value, this must inspect
          each auth_token individually to find the correct one.
  
          Tokens that have expired will be deleted and skipped
          '''
          msg = _('Invalid token.')
          token = token.decode("utf-8")
          for auth_token in AuthToken.objects.filter(
                  token_key=token[:CONSTANTS.TOKEN_KEY_LENGTH]):
              if self._cleanup_token(auth_token):
                  continue
  
              try:
                  digest = hash_token(token, auth_token.salt)
              except (TypeError, binascii.Error):
                  raise exceptions.AuthenticationFailed(msg)
              if compare_digest(digest, auth_token.digest):
                  if knox_settings.AUTO_REFRESH and auth_token.expiry:
                      self.renew_token(auth_token)
                  return self.validate_user(auth_token)
          raise exceptions.AuthenticationFailed(msgf authenticate_credentials(self, token):
          '''
          Due to the random nature of hashing a salted value, this must inspect
          each auth_token individually to find the correct one.
  
          Tokens that have expired will be deleted and skipped
          '''
          msg = _('Invalid token.')
          token = token.decode("utf-8")
          for auth_token in AuthToken.objects.filter(
                  token_key=token[:CONSTANTS.TOKEN_KEY_LENGTH]):
              if self._cleanup_token(auth_token):
                  continue
  
              try:
                  digest = hash_token(token, auth_token.salt)
              except (TypeError, binascii.Error):
                  raise exceptions.AuthenticationFailed(msg)
              if compare_digest(digest, auth_token.digest):
                  if knox_settings.AUTO_REFRESH and auth_token.expiry:
                      self.renew_token(auth_token)
                  return self.validate_user(auth_token)
          raise exceptions.AuthenticationFailed(msg)
docs: Due to the random nature of hashing a salted value, this must inspect
          each auth_token individually to find the correct one.
  
          Tokens that have expired will be deleted and skipped