api_client_creds = $api_client_creds; } /** * Set the user_id and provider, set the authorization header, call the API, and handle the response. * * @param string|null $user_id - Auth0 user ID to delete the MFA provider. * @param string $provider - MFA provider. * * @return int|mixed */ public function call( $user_id = null, $provider = 'google-authenticator' ) { if ( empty( $user_id ) || empty( $provider ) ) { return self::RETURN_ON_FAILURE; } if ( ! $this->set_bearer( self::API_SCOPE ) ) { return self::RETURN_ON_FAILURE; } return $this ->set_path( sprintf( 'api/v2/users/%s/multifactor/%s', rawurlencode( $user_id ), rawurlencode( $provider ) ) ) ->delete() ->handle_response( __METHOD__ ); } /** * Handle API response. * * @param string $method - Method that called the API. * * @return integer */ protected function handle_response( $method ) { if ( $this->handle_wp_error( $method ) ) { return self::RETURN_ON_FAILURE; } if ( $this->handle_failed_response( $method, 204 ) ) { return self::RETURN_ON_FAILURE; } return 1; } }