code: private boolean authorize(RemoteConnector mc, InputReader in) {
  		//get authorization URL
  		String authUrl;
  		try {
  			authUrl = mc.getAuthorizationURL();
  		} catch (IOException e) {
  			error("could not get authorization URL from remote server.");
  			return false;
  		}
  		
  		//ask user to point browser to authorization URL
  		System.out.println("This tool requires authorization. Please point your "
  				+ "web browser to the\nfollowing URL and follow the instructions:\n");
  		System.out.println(authUrl);
  		System.out.println();
  		
  		//open authorization tool in browser
  		if (Desktop.isDesktopSupported()) {
  			Desktop d = Desktop.getDesktop();
  			if (d.isSupported(Desktop.Action.BROWSE)) {
  				try {
  					d.browse(new URI(authUrl));
  				} catch (Exception e) {
  					//ignore. let the user open the browser manually.
  				}
  			}
  		}
  		
  		//read verification code from console
  		String verificationCode;
  		try {
  			verificationCode = in.readLine("Enter verification code: ");
  		} catch (IOException e) {
  			throw new RuntimeException("Could not read from console.");
  		}
  		
  		if (verificationCode == null || verificationCode.isEmpty()) {
  			//user aborted process
  			return false;
  		}
  		
  		//authorize...
  		try {
  			System.out.println("Connecting ...");
  			mc.authorize(verificationCode);
  		} catch (IOException e) {
  			error("remote server refused authorization.");
  			return false;
  		}
  		
  		return true;
  	}
docs: Request authorization for the tool from remote server
  @param mc the remote connector
  @param in a stream from which user input can be read
  @return true if authorization was successful