Automattic\WooCommerce\Admin\API

MobileAppQRLogin::claim_token_for_exchangeprivateWC 1.0

Atomically claim a token for exchange using the options table.

add_option() backed by a unique option_name constraint, so it works across PHP workers even on default installs without a persistent object cache. Stale claims are cleaned only if their stored value still matches the value this request observed, avoiding deletion of another worker's fresh claim.

Method of the class: MobileAppQRLogin{}

No Hooks.

Returns

true|false. True if the claim was acquired.

Usage

// private - for code of main (parent) class only
$result = $this->claim_token_for_exchange( $token_hash, $expires_at );
$token_hash(string) (required)
SHA-256 hash of the plaintext token.
$expires_at(int) (required)
Unix timestamp when the token expires.

MobileAppQRLogin::claim_token_for_exchange() code WC 11.0.1

private function claim_token_for_exchange( $token_hash, $expires_at ) {
	return $this->claim_token_with_option_key(
		$this->get_token_claim_key( $token_hash ),
		$expires_at
	);
}