I want to know if it is possible to access (at least read-access) to a private Dropbox folder without oauth.
The case is, I have a Heroku app that needs to access files and folders in a given private Dropbox folder.
Looking at the docs, the only way is through oAuth (https://www.dropbox.com/developers/core/start/android). However, my Heroku app needs to access the files and folders of a given Dropbox folder, is the App key and App secret enough to do this?
What is the right approach?
@Test
public void test() throws IOException, DbxException {
FileOutputStream outputStream = new FileOutputStream("test.txt");
DbxRequestConfig config = new DbxRequestConfig("mydbapp/1.0", Locale.getDefault().toString());
DbxClient client = new DbxClient(config, Constants.accessToken);
System.out.println("Linked account: " + client.getAccountInfo().displayName);
DbxEntry.File md = null;
try {
List<DbxEntry.File> revs = client.getRevisions("/test.txt");
md = client.getFile("/test.txt", null, outputStream);
} catch (DbxException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
outputStream.close();
}
assertNotNull(md);
}
I've been trying to debug this code, but it keeps throwing "not found" error, even if the file is in the account dropbox folder. What could be missing in this code?
Constants.accessTokenis a valid access token for the account you're trying to access. If theclient.getAccountInfo()call succeeds, then the OAuth part of your code is correct. Can you provide the actually error message and stack trace you get? I would assume you just don't have a file at the path/test.txt. Try calling metadata on "/" to see what's there. - user94559