protected function ValidateOAuth2Info()
{
$requiredFields = array('client_id', 'client_secret');
foreach ($requiredFields as $field) {
if (empty($this->oauth2Info[$field])) {
throw new ValidationException($field, null, sprintf('%s is required.', $field));
}
}
if (empty($this->oauth2Info['access_token']) && empty($this->oauth2Info['refresh_token'])) {
throw new ValidationException('refresh_token', null, 'Either the refresh_token or the access_token is required.');
}
}