I want to use Dropbox java api for using Oauth 1.0. Because I need oauth_token and oauth_token_secret. But Dropbox java sdk uses Oauth 2.0. When I use Dropbox api, Dropbox page gives me code. My server uses node js, it uses oauth 1.0. So, I have to get oauth_token, oauth_token_secret by Oauth.
1) What can I do for client just click accept button? - client just click accept button, redirect. This is my code.
webAuth = new DbxWebAuthNoRedirect(requestConfig, appInfo);
String authorizeUrl = webAuth.start();
try {
String url = authorizeUrl;
java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
}
catch (java.io.IOException e) {
System.out.println(e.getMessage());
}
String code = TextBox1.getText();
DbxAuthFinish authFinish;
try {
authFinish = webAuth.finish(code);
}
catch (DbxException ex) {
System.err.println("Error in DbxWebAuth.start: " + ex.getMessage());
}
client = new DbxClient(requestConfig, authFinish.accessToken);
2) How can I get oauth_token and oauth_token_secret? I only get access_token by using Dropbox java sdk.
I believe the current version of the Java SDK only supports OAuth 2. I would recommend just using OAuth 2 everywhere. Once you have an access token, you just need to set the Authorization
header to Bearer <token>
on your HTTP requests. This should be easy in Node.js even without a library.