WC_Helper::update_auth_option()public staticWC 1.0

Updates auth options and flushes cache

Method of the class: WC_Helper{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Helper::update_auth_option( $access_token, $access_token_secret, $site_id ): void;
$access_token(string) (required)
The access token.
$access_token_secret(string) (required)
The secret access token.
$site_id(int) (required)
The site id returned by the API.

WC_Helper::update_auth_option() code WC 9.6.0

public static function update_auth_option( string $access_token, string $access_token_secret, int $site_id ): void {
	WC_Helper_Options::update(
		'auth',
		array(
			'access_token'        => $access_token,
			'access_token_secret' => $access_token_secret,
			'site_id'             => $site_id,
			'user_id'             => get_current_user_id(),
			'updated'             => time(),
		)
	);

	// Obtain the connected user info.
	if ( ! self::_flush_authentication_cache() ) {
		self::log( 'Could not obtain connected user info in _helper_auth_return.' );
		WC_Helper_Options::update( 'auth', array() );
		wp_die( 'Something went wrong. Could not obtain connected user info in _helper_auth_return.' );
	}

	self::_flush_subscriptions_cache();
	self::_flush_updates_cache();
	self::flush_product_usage_notice_rules_cache();
}