本文整理汇总了Java中com.dropbox.core.DbxAuthFinish类的典型用法代码示例。如果您正苦于以下问题:Java DbxAuthFinish类的具体用法?Java DbxAuthFinish怎么用?Java DbxAuthFinish使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DbxAuthFinish类属于com.dropbox.core包,在下文中一共展示了DbxAuthFinish类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: get_authorization
import com.dropbox.core.DbxAuthFinish; //导入依赖的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: finishAuthAndSaveUserDetails
import com.dropbox.core.DbxAuthFinish; //导入依赖的package包/类
public void finishAuthAndSaveUserDetails(final HttpSession session, final Map<String, String[]> parameterMap) throws Exception {
final DbxSessionStore csrfTokenStore = new DbxStandardSessionStore(session, dropboxConfigProp.getSessionStore().getKey());
final DbxAuthFinish authFinish = auth.finishFromRedirect(dropboxConfigProp.getRedirectUri(), csrfTokenStore, parameterMap);
final String accessToken = authFinish.getAccessToken();
final DbxClientV2 client = new DbxClientV2(requestConfig, accessToken);
final String userId = authFinish.getUserId();
final ListFolderResult listFolderResult = client.files().listFolderBuilder("").withRecursive(true).start();
saveAccessTokenAndActualCursor(userId, accessToken, listFolderResult);
}
开发者ID:zeldan,项目名称:dropbox-webhooks-spring-boot-example,代码行数:10,代码来源:DropboxService.java
示例3: authenticate
import com.dropbox.core.DbxAuthFinish; //导入依赖的package包/类
@Override
public boolean authenticate(String code) {
try {
DbxAuthFinish authFinish = webAuth.finish(code);
dbClient = new DbxClient(config, authFinish.accessToken);
Credentials cred = new Credentials();
//Remove old credentials, if they exist
cred.removeCredentials("dropbox");
//Save new credentials
cred.saveCredentials("dropbox", authFinish.accessToken);
bearerToken = authFinish.accessToken;
authenticated = true;
return true;
} catch (DbxException e) {
e.printStackTrace();
authenticated = false;
return false;
}
}
开发者ID:modcs,项目名称:caboclo,代码行数:28,代码来源:DropboxClient.java
示例4: doAuthorize
import com.dropbox.core.DbxAuthFinish; //导入依赖的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
注:本文中的com.dropbox.core.DbxAuthFinish类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论