def authenticate_credentials(self, token: bytes, request=None):
        """
        Authenticate the token with optional request for context.
        """
        user = AuthToken.get_user_for_token(token)

        if user is None:
            raise AuthenticationFailed(_('Invalid auth token.'))

        if not user.is_active:
            raise AuthenticationFailed(_('User inactive or deleted.'))

        return user, token