当前位置: 首页>>代码示例>>Java>>正文


Java DbxWebAuthNoRedirect类代码示例

本文整理汇总了Java中com.dropbox.core.DbxWebAuthNoRedirect的典型用法代码示例。如果您正苦于以下问题:Java DbxWebAuthNoRedirect类的具体用法?Java DbxWebAuthNoRedirect怎么用?Java DbxWebAuthNoRedirect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DbxWebAuthNoRedirect类属于com.dropbox.core包,在下文中一共展示了DbxWebAuthNoRedirect类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get_authorization

import com.dropbox.core.DbxWebAuthNoRedirect; //导入依赖的package包/类
public static DbxAuthFinish get_authorization(JDialog parent, DbxAppInfo appInfo, DbxRequestConfig config) throws DbxException {
 DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(config, appInfo);
	
 // Have the user sign in and authorize your app.
 String authorizeUrl = webAuth.start();

 String auth_prompt = get_auth_prompt(authorizeUrl);
 JTextArea text = new JTextArea(auth_prompt);
 text.setLineWrap(true);
 text.setWrapStyleWord(true);
 JScrollPane scrollpane = new JScrollPane(text);
 scrollpane.setPreferredSize(new Dimension(200, 200));
 String code = JOptionPane.showInputDialog(scrollpane);

 // This will fail if the user enters an invalid authorization code.
 return webAuth.finish(code);

}
 
开发者ID:kd0kfo,项目名称:dropboxconnector,代码行数:19,代码来源:Connector.java

示例2: startAuthentication

import com.dropbox.core.DbxWebAuthNoRedirect; //导入依赖的package包/类
/**
 * Starts the OAuth authorization process with Dropbox. This is a
 * multi-step process which is described in the Wiki.
 * 
 * @throws DbxException if there are technical or application level errors
 *             in the Dropbox communication
 * 
 * @see <a href="https://github.com/openhab/openhab/wiki/Dropbox-IO">openHAB Dropbox IO Wiki</a>
 */
public void startAuthentication() throws DbxException {
    if (personalAccessToken == null) {
        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");
        logger.info("# 3. Paste the authorisation code here using the command 'finishAuthentication \"<token>\"'");
        logger.info("#########################################################################################");
    } else {
        logger.info("#########################################################################################");
        logger.info("# Starting auth using personal access token");
        logger.info("#########################################################################################");
        writeAccessToken(personalAccessToken);
        startSynchronizationJobs();
    }
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:29,代码来源:DropboxService.java

示例3: startAuthentication

import com.dropbox.core.DbxWebAuthNoRedirect; //导入依赖的package包/类
/**
 * Starts the OAuth authorization process with Dropbox. The authorization
 * process is a multi step process which is described in the Wiki in detail.
 * 
 * @throws DbxException if there are technical or application level errors 
 * in the Dropbox communication
 * 
 * @see <a href="https://github.com/openhab/openhab/wiki/Dropbox-IO">openHAB Dropbox IO 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");
	logger.info("# 3. Paste the authorisation code here using the command 'finishAuthentication \"<token>\"'");
	logger.info("#########################################################################################");
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:21,代码来源:DropboxSynchronizer.java

示例4: finishAuthentication

import com.dropbox.core.DbxWebAuthNoRedirect; //导入依赖的package包/类
/**
 * Finishes the OAuth authorization process by taking the given {@code token} and creating 
 * an accessToken out of it. The authorization process is a multi step process which is 
 * described in the Wiki in detail.
 * 
 * @throws DbxException if there are technical or application level errors 
 * in the Dropbox communication
 * 
 * @see <a href="https://github.com/openhab/openhab/wiki/Dropbox-IO">openHAB Dropbox IO 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("#########################################################################################");
	
	startSynchronizationJobs();
}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:22,代码来源:DropboxSynchronizer.java

示例5: getOauthURL

import com.dropbox.core.DbxWebAuthNoRedirect; //导入依赖的package包/类
@Override
public String getOauthURL() {
    DbxAppInfo appInfo = new DbxAppInfo(APP_KEY, APP_SECRET);

    webAuth = new DbxWebAuthNoRedirect(config, appInfo);

    return webAuth.start();
}
 
开发者ID:modcs,项目名称:caboclo,代码行数:9,代码来源:DropboxClient.java

示例6: finishAuthentication

import com.dropbox.core.DbxWebAuthNoRedirect; //导入依赖的package包/类
/**
 * Finishes the OAuth authorization process by taking the given {@code token} and creating
 * an accessToken out of it. The authorization process is a multi-step process which is
 * described in the Wiki in detail.
 * 
 * @throws DbxException if there are technical or application level errors
 *             in the Dropbox communication
 * 
 * @see <a href="https://github.com/openhab/openhab/wiki/Dropbox-IO">openHAB Dropbox IO 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("#########################################################################################");

    startSynchronizationJobs();
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:22,代码来源:DropboxService.java

示例7: doAuthorize

import com.dropbox.core.DbxWebAuthNoRedirect; //导入依赖的package包/类
private void doAuthorize() {
    DbxAppInfo appInfo = new DbxAppInfo(this.apiKey, this.apiKeySecret);
    DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(requestConfig, appInfo);

    String authorizationCode = "";
    System.out.println("1. Go to " + webAuth.start());
    System.out.println("2. Click \"Allow\" (you might have to log in first).");
    System.out.println("3. Copy the authorization code.");
    System.out.print("Enter the authorization code: ");
    BufferedReader consoleIn = null;
    try {
        consoleIn = new BufferedReader(new InputStreamReader(System.in));
        authorizationCode = consoleIn.readLine();
    } catch (IOException ioe) {
        ioe.printStackTrace(System.err);
    }
    if (authorizationCode == null || authorizationCode.length() == 0) {
        System.err.println("Invalid authorization code!");
        System.err.println("Exiting now...");
        System.exit(1);
    }

    DbxAuthFinish authFinish = null;
    try {
        authFinish = webAuth.finish(authorizationCode);
    } catch (DbxException ex) {
        System.err.println("Error in DbxWebAuth.start: " + ex.getMessage());
        System.err.println("Exiting now...");
        System.exit(1);
    }
    if (authFinish == null) {
        System.err.println("Something went wrong doing the authorization!");
        System.err.println("Exiting now...");
        System.exit(1);
    }

    System.out.println("Authorization completed successfully!");
    System.out.println("- User ID: " + authFinish.userId);
    System.out.println("- Access Token: " + authFinish.accessToken);

    accessToken = authFinish.accessToken;

    // Write this already out
    writeOut();
}
 
开发者ID:TomVSt,项目名称:JavaPiSync,代码行数:46,代码来源:JavaPiSync.java

示例8: getDbxWebAuthNoRedirect

import com.dropbox.core.DbxWebAuthNoRedirect; //导入依赖的package包/类
private static DbxWebAuthNoRedirect getDbxWebAuthNoRedirect() {
    return new DbxWebAuthNoRedirect(config, appInfo);
}
 
开发者ID:adelolmo,项目名称:biblio,代码行数:4,代码来源:CreateDialog.java


注:本文中的com.dropbox.core.DbxWebAuthNoRedirect类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。