WC_Helper::update_auth_option
Updates auth options and flushes cache
Method of the class: WC_Helper{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WC_Helper::update_auth_option( $access_token, $access_token_secret, $site_id, $home_url ): 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.
- $home_url(string) (required)
- Home url of the site.
WC_Helper::update_auth_option() WC Helper::update auth option code WC 10.3.3
public static function update_auth_option( string $access_token, string $access_token_secret, int $site_id, string $home_url ): void {
WC_Helper_Options::update(
'auth',
array(
'access_token' => $access_token,
'access_token_secret' => $access_token_secret,
'site_id' => $site_id,
'url' => $home_url,
'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();
}