WC_Helper::_flush_authentication_cache()
Flush auth cache.
Description Description
Source Source
File: includes/admin/helper/class-wc-helper.php
public static function _flush_authentication_cache() {
$request = WC_Helper_API::get(
'oauth/me',
array(
'authenticated' => true,
)
);
if ( wp_remote_retrieve_response_code( $request ) !== 200 ) {
return false;
}
$user_data = json_decode( wp_remote_retrieve_body( $request ), true );
if ( ! $user_data ) {
return false;
}
WC_Helper_Options::update(
'auth_user_data',
array(
'name' => $user_data['name'],
'email' => $user_data['email'],
)
);
return true;
}