cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you an educator? Well we want to hear from you, so check out some tools we think might help you out 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: 

Authorization requires web browser even for dev?

Authorization requires web browser even for dev?

William M.46
Explorer | Level 3

This is painful... 

The Java examples rely on an auth file created via the Authorization example.  Which in turn requires building this code, and running a web browser...

 

String authorizeUrl = webAuth.authorize(webAuthRequest);
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.");
System.out.print("Enter the authorization code here: ");

 

Now, I can get an auth code for me from DropBox directly, but the DbxAuthInfo structure also requires a non-NULL host.  And has no documentation about that.  This example doesn't have it either; the user and secret are submitted and the auth code retrieved.

 

From https://www.dropbox.com/developers/apps/info/..., how do I get the host?  

 

2 Replies 2

Re: Authorization requires web browser even for dev?

Greg-DB
Dropboxer

Apologies for the confusion. The DbxHost should identify the Dropbox API servers, but you generally don't need to actually use any of that. You can default to the standard hosts.

 

For example, you can just use this constructor to make a DbxAppInfo without specifying host.

 

And outside of the structure of the examples, you really only need the access token, e.g., as acquired here. You can store and re-use that for future calls.

 

You can use that to make a DbxClientV2 without specifying host using this constructor.

 

(For reference though, the default DbxHost is DbxHost.DEFAULT.)

Re: Authorization requires web browser even for dev?

William M.46
Explorer | Level 3

Well that was challenging.   That worked but it took a while to realize it. Even though I'd removed the old Dropbox and Jackson (?) JARs from my libraries list, the Jackson one was still in the /lib folder and therefore was apparently being found before the newer Jackson-core (which was also there), resulting in java.lang.NoSuchFieldError: DEFAULT  java.lang.reflect.InvocationTargetException and so on.  

 

 

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    William M.46 Explorer | Level 3
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?