Yoast\WP\SEO\MyYoast_Client\Application

MyYoast_Client::get_site_tokenpublicYoast 1.0

Returns a valid site-level access token (client_credentials).

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

Хуков нет.

Возвращает

Token_Set. The site-level token set.

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

$MyYoast_Client = new MyYoast_Client();
$MyYoast_Client->get_site_token( $scopes ): Token_Set;
$scopes(string[])
The service: scopes to request.
По умолчанию: []*

Код MyYoast_Client::get_site_token() Yoast 27.7

public function get_site_token( array $scopes = [] ): Token_Set {
	$cached = $this->token_storage->get();
	if ( $cached !== null && ! $cached->is_expired() && $cached->has_scopes( $scopes ) ) {
		return $cached;
	}

	$grant     = new Client_Credentials_Grant( $scopes, $this->site_url_provider->get() );
	$token_set = $this->grant_handler->request_token( $grant );
	$this->token_storage->store( $token_set );

	return $token_set;
}