String token = Files.exists(this.tokenPath) ? FileUtils.readFileToString(this.tokenPath.toFile()) : null;
DbxAppInfo appInfo = new DbxAppInfo(dropboxOptions.getAppKey(), dropboxOptions.getAppSecret());
DbxRequestConfig config = new DbxRequestConfig("Cloudsync/1.0", Locale.getDefault().toString());
DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(config, appInfo);
if (StringUtils.isEmpty(token)) {
final String url = webAuth.start();
System.out.println("Please open the following URL in your browser, click \"Allow\" (you might have to log in first) and copy the authorization code and enter below");
System.out.println("\n" + url + "\n");
final String code = new BufferedReader(new InputStreamReader(System.in)).readLine().trim();
DbxAuthFinish authFinish = webAuth.finish(code);
token = authFinish.accessToken;
FileUtils.write(this.tokenPath.toFile(), token);
LOGGER.log(Level.INFO, "client token stored in '" + this.tokenPath + "'");