def add_token_expiration_to_checkpoint_file(self, token_data, from_refresh_token: bool):
        """Add token to keyvault and expiration time to checkpoint file.

        Args:
            token_data (json): token_data to be added in checkpoint file and keyvault.
        """
        try:
            __method_name = inspect.currentframe().f_code.co_name
            checkpoint_data = {}
            self.access_token = token_data["access_token"]
            self.session.headers["Authorization"] = "bearer {}".format(
                    self.access_token
                )
            self.access_token_expiration = (
                datetime.datetime.now() + timedelta(seconds=token_data["expires_in"])
            ).isoformat()
            if not from_refresh_token:
                self.applogger.info(
                    "{}(method={}) : {} : Both access token and refresh token are generated successfully.".format(
                        consts.LOGS_STARTS_WITH, __method_name, self.function_name
                    )
                )
                self.refresh_token = token_data["refresh_token"]
                self.keyvault_obj.set_keyvault_secret(self.refresh_token_key, self.refresh_token)
                self.refresh_token_expiration = (
                    datetime.datetime.now() + timedelta(seconds=token_data["refresh_expires_in"])
                ).isoformat()
                token_data = {
                    self.access_token_expiry: self.access_token_expiration,
                    self.refresh_token_expiry: self.refresh_token_expiration,
                }
            else:
                self.applogger.info(
                    "{}(method={}) : {} :  Access Token Generated from Refresh Token.".format(
                        consts.LOGS_STARTS_WITH, __method_name, self.function_name
                    )
                )
                token_data = {self.access_token_expiry: self.access_token_expiration}
            checkpoint_data.update(token_data)
            self.keyvault_obj.set_keyvault_secret(self.access_token_key, self.access_token)
            self.save_checkpoint(data=checkpoint_data, token_expiry_time=True)
        except Exception as err:
            self.applogger.error(
                "{}(method={}) : {} : Error occured in storing token or expiration time: {} ".format(
                    consts.LOGS_STARTS_WITH, __method_name, self.function_name, err
                )
            )
            raise Exception(
                "Error occured in storing token to keyvault or expiration time to checkpoint file : {}".format(err)
            )
Add token to keyvault and expiration time to checkpoint file.

        Args:
            token_data (json): token_data to be added in checkpoint file and keyvault.
        
Solutions/Vectra XDR/Data Connectors/VectraDataConnector/SharedCode/collector.py