Yoast\WP\SEO\MyYoast_Client\Infrastructure\Http
HTTP_Client::authenticated_request
Sends an authenticated resource request with DPoP proof. Authenticate with a (DPoP bound) access token or refresh token, an Initial Access Token, or a Client Registration Access Token, depending on the token type and endpoint requirements.
Метод класса: HTTP_Client{}
Хуков нет.
Возвращает
HTTP_Response. The parsed response.
Использование
$HTTP_Client = new HTTP_Client(); $HTTP_Client->authenticated_request( string $method, string $url,;
Код HTTP_Client::authenticated_request() HTTP Client::authenticated request Yoast 28.9
public function authenticated_request(
string $method,
string $url,
// phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPNativeAttributeFound -- No-op on PHP < 8.2; redacts parameter from stack traces on PHP 8.2+.
#[SensitiveParameter]
string $access_token,
string $token_type = Auth_Token_Type::DPOP,
array $options = []
): HTTP_Response {
$headers = ( $options['headers'] ?? [] );
$headers['Authorization'] = $token_type . ' ' . $access_token;
return $this->request(
$method,
$url,
\array_merge(
$options,
[
'headers' => $headers,
'dpop' => ( $token_type === Auth_Token_Type::DPOP ),
'access_token' => $access_token,
],
),
);
}