cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using proxy setting in java sdk

Using proxy setting in java sdk

vishal s.7
New member | Level 1

Hello

I am working in the network that uses proxy setting. How can I mention the Proxy setting in java sdk?

public static void main(String[] args) throws IOException, DbxException {
    // Get your app key and secret from the Dropbox developers website.
    final String APP_KEY = "f1klbew9x73o79w";
    final String APP_SECRET = "xxxxxxxxxxxxxx";

    DbxAppInfo appInfo = new DbxAppInfo(APP_KEY, APP_SECRET);

    DbxRequestConfig config = new DbxRequestConfig("JavaTutorial/1.0",
        Locale.getDefault().toString());
    DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(config, appInfo);

    // Have the user sign in and authorize your app.
    String authorizeUrl = webAuth.start();
    System.out.println("1. Go to: " + authorizeUrl);
    System.out.println("2. Click \"Allow\" (you might have to log in first)");
    System.out.println("3. Copy the authorization code.");
    //String code = new BufferedReader(new InputStreamReader(System.in)).readLine().trim();

    // This will fail if the user enters an invalid authorization code.
    //DbxAuthFinish authFinish = webAuth.finish(code);
    String accessToken = "XXX";//authFinish.accessToken;

    DbxClient client = new DbxClient(config, accessToken);

    System.out.println("Linked account: " + client.getAccountInfo().displayName);
}

Above program works fine in network with no proxy.

Thanks in advance

1 Reply 1

Greg-DB
Dropbox Staff

I unfortunately don't have any actual sample code for this, but I believe you can supply a proxy object to this StandardHttpRequestor constructor:

http://dropbox.github.io/dropbox-sdk-java/api-docs/v1.7.x/com/dropbox/core/http/StandardHttpRequesto...

And then you can supply that HttpRequestor to this DbxRequestConfig constructor:

http://dropbox.github.io/dropbox-sdk-java/api-docs/v1.7.x/com/dropbox/core/DbxRequestConfig.html#Dbx...

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?