Examples of DbxWebAuthNoRedirect


Examples of com.dropbox.core.DbxWebAuthNoRedirect

      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 + "'");
View Full Code Here

Examples of com.dropbox.core.DbxWebAuthNoRedirect

   * in the Dropbox communication
   *
   * @see <a href="http://code.google.com/p/openhab/wiki/DropboxIOBundle">openHAB Dropbox Wiki</a>
   */
  public void startAuthentication() throws DbxException {
    DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(requestConfig, appInfo);
    String authUrl = webAuth.start();

    logger.info("#########################################################################################");
    logger.info("# Dropbox-Integration: U S E R   I N T E R A C T I O N   R E Q U I R E D !!");
    logger.info("# 1. Open URL '{}'", authUrl);
    logger.info("# 2. Allow openHAB to access Dropbox");
View Full Code Here

Examples of com.dropbox.core.DbxWebAuthNoRedirect

   * in the Dropbox communication
   *
   * @see <a href="http://code.google.com/p/openhab/wiki/DropboxIOBundle">openHAB Dropbox Wiki</a>
   */
  public void finishAuthentication(String code) throws DbxException {
    DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(requestConfig, appInfo);
        String accessToken = webAuth.finish(code).accessToken;
    writeAccessToken(accessToken);
   
    logger.info("#########################################################################################");
    logger.info("# OAuth2 authentication flow has been finished successfully ");
    logger.info("#########################################################################################");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.