Yoast\WP\SEO\Config

OAuth_Client::request_tokens()publicYoast 1.0

Requests the access token and refresh token based on the passed code.

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

Хуков нет.

Возвращает

OAuth_Token. The requested tokens.

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

$OAuth_Client = new OAuth_Client();
$OAuth_Client->request_tokens( $code );
$code(строка) (обязательный)
The code to send.

Код OAuth_Client::request_tokens() Yoast 22.4

public function request_tokens( $code ) {
	try {
		$response = $this->provider
			->getAccessToken(
				'authorization_code',
				[
					'code' => $code,
				]
			);

		$token = OAuth_Token::from_response( $response );

		return $this->store_token( $token );
	} catch ( Exception $exception ) {
		throw new Authentication_Failed_Exception( $exception );
	}
}