Yoast\WP\SEO\AI\Authentication\Application
OAuth_Auth_Strategy::challenge_error
Extracts the error="…" token from a WWW-Authenticate challenge header.
Parses the RFC 6750 § 3 / RFC 9449 § 7.1 challenge (e.g. Bearer error="invalid_token", DPoP error="invalid_dpop_proof") and returns the lower-cased code, or an empty string when no challenge or error parameter is present.
Метод класса: OAuth_Auth_Strategy{}
Хуков нет.
Возвращает
Строку. The challenge error code, lower-cased, or an empty string.
Использование
// private - только в коде основоного (родительского) класса $result = $this->challenge_error( $headers ): string;
- $headers(массив) (обязательный)
- .
Код OAuth_Auth_Strategy::challenge_error() OAuth Auth Strategy::challenge error Yoast 28.3
private function challenge_error( array $headers ): string {
$www_authenticate = $this->get_header_value( $headers, 'www-authenticate' );
if ( $www_authenticate === null ) {
return '';
}
if ( \preg_match( '/error\s*=\s*"([^"]*)"/i', $www_authenticate, $matches ) === 1 ) {
return \strtolower( $matches[1] );
}
return '';
}