WC_Helper_API::add_auth_parameters()public staticWC 1.0

Add the access token and signature to the provided URL.

Method of the class: WC_Helper_API{}

No Hooks.

Return

String.

Usage

$result = WC_Helper_API::add_auth_parameters( $url ): string;
$url(string) (required)
The URL to add the access token and signature to.

WC_Helper_API::add_auth_parameters() code WC 9.7.1

public static function add_auth_parameters( string $url ): string {
	$auth = WC_Helper_Options::get( 'auth' );

	if ( empty( $auth['access_token'] ) || empty( $auth['access_token_secret'] ) ) {
		return false;
	}

	$signature = self::create_request_signature( (string) $auth['access_token_secret'], $url, 'GET' );

	return add_query_arg(
		array(
			'token'     => $auth['access_token'],
			'signature' => $signature,
		),
		$url
	);
}