本文整理汇总了Java中com.dropbox.core.DbxAppInfo类的典型用法代码示例。如果您正苦于以下问题:Java DbxAppInfo类的具体用法?Java DbxAppInfo怎么用?Java DbxAppInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DbxAppInfo类属于com.dropbox.core包,在下文中一共展示了DbxAppInfo类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get_authorization
import com.dropbox.core.DbxAppInfo; //导入依赖的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);
}
示例2: getOauthURL
import com.dropbox.core.DbxAppInfo; //导入依赖的package包/类
@Override
public String getOauthURL() {
DbxAppInfo appInfo = new DbxAppInfo(APP_KEY, APP_SECRET);
webAuth = new DbxWebAuthNoRedirect(config, appInfo);
return webAuth.start();
}
示例3: dbxWebAuth
import com.dropbox.core.DbxAppInfo; //导入依赖的package包/类
@Bean
public DbxWebAuth dbxWebAuth(final DbxRequestConfig requestConfig) {
final DbxAppInfo appInfo = new DbxAppInfo(dropboxConfigProperties.getKey(), dropboxConfigProperties.getSecret());
return new DbxWebAuth(requestConfig, appInfo);
}
示例4: doAuthorize
import com.dropbox.core.DbxAppInfo; //导入依赖的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();
}
示例5: Main
import com.dropbox.core.DbxAppInfo; //导入依赖的package包/类
private Main(PrintWriter log, DbxAppInfo dbxAppInfo, File userDbFile) throws IOException, Common.DatabaseException {
this.common = new Common(log, dbxAppInfo, userDbFile);
this.dropboxAuth = new DropboxAuth(common);
this.dropboxBrowse = new DropboxBrowse(common);
}
示例6: Common
import com.dropbox.core.DbxAppInfo; //导入依赖的package包/类
public Common(PrintWriter log, DbxAppInfo dbxAppInfo, File userDbFile) throws IOException, DatabaseException {
this.log = log;
this.dbxAppInfo = dbxAppInfo;
this.userDbFile = userDbFile;
this.userDb = loadUserDb(userDbFile);
}
示例7: initialize
import com.dropbox.core.DbxAppInfo; //导入依赖的package包/类
private void initialize(Context ctx, String _appKey, String _appSecret,
boolean clearKeysOnStart, AccessType accessType) {
appInfo = new DbxAppInfo(_appKey,_appSecret);
mContext = ctx;
if (clearKeysOnStart)
clearKeys();
this.mAccessType = accessType;
buildSession();
}
示例8: connect
import com.dropbox.core.DbxAppInfo; //导入依赖的package包/类
public static DbxClient connect(APIKeyStore apikey, JDialog parent) throws IOException, DbxException {
BuildInfo info = new BuildInfo(Connector.class);
DbxAppInfo appInfo = new DbxAppInfo(apikey.APP_KEY, apikey.APP_SECRET);
DbxRequestConfig config = new DbxRequestConfig("DropboxConnector/" + info.get_version(),
Locale.getDefault().toString());
return new DbxClient(config, get_authorization(parent, appInfo, config).accessToken);
}