Yoast\WP\SEO\MyYoast_Client\Application\Grants

Refresh_Token_Grant{}Yoast 1.0└─ Grant_Interface

Grant strategy for the Refresh Token flow (RFC 6749 Section 6).

Exchanges a refresh token for new access and refresh tokens.

Хуков нет.

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

$Refresh_Token_Grant = new Refresh_Token_Grant();
// use class methods

Методы

  1. public __construct(
  2. public get_grant_params()
  3. public get_grant_type()

Код Refresh_Token_Grant{} Yoast 27.7

class Refresh_Token_Grant implements Grant_Interface {

	/**
	 * The refresh token.
	 *
	 * @var string
	 */
	private $refresh_token;

	/**
	 * Refresh_Token_Grant constructor.
	 *
	 * @param string $refresh_token The refresh token.
	 */
	public function __construct(
		// phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPNativeAttributeFound -- No-op on PHP < 8.2; redacts parameter from stack traces on PHP 8.2+.
		#[SensitiveParameter]
		string $refresh_token
	) {
		$this->refresh_token = $refresh_token;
	}

	/**
	 * Returns the grant type identifier.
	 *
	 * @return string
	 */
	public function get_grant_type(): string {
		return 'refresh_token';
	}

	/**
	 * Returns the grant-specific parameters.
	 *
	 * @return array<string, string>
	 */
	public function get_grant_params(): array {
		return [
			'refresh_token' => $this->refresh_token,
		];
	}
}