def METHOD_NAME(self, request: Request, identifier: str) -> Response:
    """Set token key. Action is logged as event. `authentik_core.set_token_key` permission
    is required."""
    token: Token = self.get_object()
    key = request.data.get("key")
    if not key:
        return Response(status=400)
    token.key = key
    token.save()
    Event.new(EventAction.MODEL_UPDATED, model=model_to_dict(token)).from_http(
        request
    )  # noqa # nosec
    return Response(status=204)