def validate_connection(self):
        """To validate the connection with vectra and generate access token."""
        __method_name = inspect.currentframe().f_code.co_name
        try:
            self.load_tokens_from_keyvault()
            self.load_expiration_time_from_checkpoint_file()
            self.validate_access_token()
            if self.access_token:
                self.session.headers["Authorization"] = "bearer {}".format(self.access_token)
                self.applogger.info(
                    "{}(method={}) : {} : Token or Connection validation is successful.".format(
                        consts.LOGS_STARTS_WITH, __method_name, self.function_name
                    )
                )
                return
        except Exception as ex:
            raise Exception(ex)
To validate the connection with vectra and generate access token.
Solutions/Vectra XDR/Data Connectors/VectraDataConnector/SharedCode/collector.py