public static function request_authorization($scope=null, $callback_url=null) {
	$config = static::get_config();
	
	if (!empty($callback_url) && strpos($callback_url, $config['callback_url']) !== 0) {
		$exception = bootstrap::get_library('exception');
		throw new $exception('custom callback url needs to start with defined callback url');
	}
	if (empty($callback_url)) {
		$callback_url = $config['callback_url'];
	}
	
	$text    = bootstrap::get_library('text');
	$session = bootstrap::get_library('session');
	$request = bootstrap::get_library('request');
	
	// state is a shared secret to prevent people faking the callback
	$state = $text::generate_token($length=40);
	
	$session::start(session::TYPE_TEMPORARY);
	$_SESSION['fem/login_github/state'] = $state;
	$_SESSION['fem/login_github/scope'] = $scope;
	
	// let the user authorize at github
	$url       = 'https://github.com/login/oauth/authorize';
	$arguments = [
		'client_id' => $config['client_id'],
		'scope'     => $scope,
		'state'     => $state,
	];
	$request::redirect($url.'?'.http_build_query($arguments));
}