WC_REST_Authentication::authenticate( int|false $user_id )

Authenticate user.


Description Description


Parameters Parameters

$user_id

(Required) User ID if one has been determined, false otherwise.


Top ↑

Return Return

(int|false)


Top ↑

Source Source

File: includes/class-wc-rest-authentication.php

	public function authenticate( $user_id ) {
		// Do not authenticate twice and check if is a request to our endpoint in the WP REST API.
		if ( ! empty( $user_id ) || ! $this->is_request_to_rest_api() ) {
			return $user_id;
		}

		if ( is_ssl() ) {
			$user_id = $this->perform_basic_authentication();
		}

		if ( $user_id ) {
			return $user_id;
		}

		return $this->perform_oauth_authentication();
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.