/**
* Authorizations
*/
function client_authorize()
{
$data = stripslashes_deep($_GET);
$data['auth_type'] = 'client';
$role = Jetpack::translate_current_user_to_role();
$redirect = isset($data['redirect']) ? esc_url_raw((string) $data['redirect']) : '';
$this->check_admin_referer("jetpack-authorize_{$role}_{$redirect}");
$result = $this->authorize($data);
if (is_wp_error($result)) {
Jetpack::state('error', $result->get_error_code());
}
if (wp_validate_redirect($redirect)) {
$this->wp_safe_redirect($redirect);
} else {
$this->wp_safe_redirect(Jetpack::admin_url());
}
/**
* Fires after the Jetpack client is authorized to communicate with WordPress.com.
*
* @since 4.2.0
*
* @param int Jetpack Blog ID.
*/
do_action('jetpack_client_authorized', Jetpack_Options::get_option('id'));
$this->do_exit();
}