Automattic\WooCommerce\StoreApi
Authentication::init
Hook into WP lifecycle events. This is hooked by the StoreAPI class on rest_api_init.
Method of the class: Authentication{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Authentication = new Authentication(); $Authentication->init();
Authentication::init() Authentication::init code WC 10.7.0
public function init() {
if ( ! $this->is_request_to_store_api() ) {
return;
}
add_filter( 'rest_authentication_errors', array( $this, 'check_authentication' ) );
add_filter( 'rest_authentication_errors', array( $this, 'opt_in_checkout_endpoint' ), 9, 1 );
add_action( 'set_logged_in_cookie', array( $this, 'set_logged_in_cookie' ) );
add_filter( 'rest_pre_serve_request', array( $this, 'send_cors_headers' ), 10, 4 );
add_filter( 'rest_allowed_cors_headers', array( $this, 'allowed_cors_headers' ) );
add_filter( 'rest_exposed_cors_headers', array( $this, 'exposed_cors_headers' ) );
// Remove the default CORS headers--we will add our own.
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
}