public static function is_valid($callback_data, $extended=true) {
	$exception = bootstrap::get_library('exception');
	
	if (empty($callback_data['state'])) {
		throw new $exception('state expected in oauth callback');
	}
	
	$session = bootstrap::get_library('session');
	$session::start($session::TYPE_TEMPORARY);
	if ($callback_data['state'] != $_SESSION['fem/login_github/state']) {
		throw new $exception('state is different, someone tries to fake the callback?');
	}
	
	if (empty($callback_data['code'])) {
		return false;
	}
	
	if ($extended) {
		return static::is_valid_extended($callback_data);
	}
	return true;
}