Yoast\WP\SEO\AI\Authentication\Application

OAuth_Auth_Strategy::is_consent_required │ private │ Yoast 1.0

Whether the forbidden response means the user's consent is required.

The yoast-ai consent gate returns a 403 carrying neither an error_code nor a WWW-Authenticate challenge — only the free-text message "The consent of the user is required to perform this action". With no machine-readable discriminator available, the message is the only signal, so this matches the word "consent" case-insensitively. The check runs only after the insufficient_scope branch, so a scope failure is never misread as a consent failure.

Метод класса: OAuth_Auth_Strategy{}

Хуков нет.

Возвращает

bool. True if the response indicates consent is required.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->is_consent_required( $exception ): bool;
$exception(Forbidden_Exception) (обязательный)
The exception to inspect.

Код OAuth_Auth_Strategy::is_consent_required() Yoast 28.9

private function is_consent_required( Forbidden_Exception $exception ): bool {
	return ( \stripos( $exception->getMessage(), 'consent' ) !== false );
}