Yoast\WP\SEO\Actions\Wincher

Wincher_Login_Action::authenticate()publicYoast 1.0

Authenticates with Wincher to request the necessary tokens.

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

Хуков нет.

Возвращает

Объект. The response object.

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

$Wincher_Login_Action = new Wincher_Login_Action();
$Wincher_Login_Action->authenticate( $code, $website_id );
$code(строка) (обязательный)
The authentication code to use to request a token with.
$website_id(строка) (обязательный)
The website id associated with the code.

Код Wincher_Login_Action::authenticate() Yoast 19.11

public function authenticate( $code, $website_id ) {
	// Code has already been validated at this point. No need to do that again.
	try {
		$tokens = $this->client->request_tokens( $code );
		$this->options_helper->set( 'wincher_website_id', $website_id );

		return (object) [
			'tokens' => $tokens->to_array(),
			'status' => 200,
		];
	} catch ( Authentication_Failed_Exception $e ) {
		return $e->get_response();
	}
}