Android Question Converting from DropboxSync (v3.00) to Dropbox V2 Library

Turbo3

Active Member
Licensed User
Longtime User
My app has been using the DropboxSync (v3.00) library for years now and needs to be changed due to Dropbox dropping support for the older V1 APIs it uses as of Sept 28th.

I see two new libraries. DropboxHttpAPI and DropboxV2 with the later being the newer but with an April 2017 note saying it has some issues.

My usage is a dedicated app folder on Dropbox for my app's files to be uploaded and downloaded. No need for access to any other user folders. Permission type is "App folder".

The Dropbox app console page gives me a key and secret which for DropboxSync are placed in xxx.Initialize(key,secret,"manager") and then I call xxx.LinkAccount. After these two calls I am good to go for uploading and downloading files to my app's Dropbox dedicated folder and to create any needed sub-folders.

I have not yet found a good example showing initialization using both the "key" and "secret". I do see reference to an "AccessToken" and using the "key" but nothing about where the "secret" goes.

The manifest also needs to have the "key" entered in similar to the old DropboxSync library. I see example of that.

A simple example of initializing the connection to my App's Dropbox folder with key/secret and then upload and download a file would greatly help me. Thanks.
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Turbo3

Active Member
Licensed User
Longtime User
My question was how to use key & secret to initialize access to a Dropbox app folder. The initialize method in dropboxhttp class needs an AccessToken. How do you go from key/secret to AccessToken?

initialize (CallbackModule AsObject, EventName AsString, AccessToken AsString, debug AsBoolean) As String
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
How do you go from key/secret to AccessToken?
You can get the accesstoken in the Dropbox-console. Use this accesstoken then. You can use this token to access YOUR dropbox.

OR you need to go over the Authentification flow and use the client secret and key to initialize the flow and get an accesstoken after the user authenticated th request.

Snap9.png
 
Last edited:
Upvote 0

Turbo3

Active Member
Licensed User
Longtime User
What you are calling the "client secret and key" is the secret and key on my Dropbox-console assigned to my app. There is no accesstoken on my Dropbox-console as I am using an "App folder". Perhaps I was not clear but my app allows my users to upload data when running my app to an app specific folder on "their" Dropbox. Nothing to do with me.

How do you start the Authentication process with an app key and secret to link to my customer's app Dropbox folder?
 
Upvote 0

Turbo3

Active Member
Licensed User
Longtime User
Is there a chart showing this "OAuth2 flow"?

So in the OAuth2 flow there is a step where I give it the key and secret associated with my app's folder from my Dropbox-console and I get back an accesstoken that gives my app access to their Dropbox folder. Again I am not giving anyone access to my Dropbox folder.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I dont know a chart about this.
See dropbox http documentation on how to do the OAuth-flow.
You need to setup a webpage for the redirecturl which then get the token. the webpage need to save the token and give it to your app somehow. Maybe a pushnotification...

I don´t know if this (old) example still works. But i guess it should. Just try it...
See this Example: https://www.b4x.com/android/forum/t...all-using-httputils2.56842/page-3#post-389573


Using the java library (Dropbox V2 java) you are alredy able to do what you want. The oauth-flow is possible here already.
 
Last edited:
Upvote 0

Turbo3

Active Member
Licensed User
Longtime User
Where do I get the clientID? I tried the App key but get an Error (400)
"Invalid redirect_uri. It must exactly match one of the redirect URIs you've pre-configured for your app (including the path)"

On my App Dropbox console I do not see any clientID or any other field with "client" in it.

I see an OAuth2 section with a place for a "Redirect URI's" but I have no idea what goes there. I can request an access token there but it explicitly says the token is to give access to MY Dropbox which is not what my app needs.

Does Dropbox no longer allow an app to create and access an App folder which is what the top part of the console page is about? Is that why I am getting no response to my question about where does the App key and App secret go because they are no longer supported in V2?

Update:
From the Dropbox V2 migration guide it says the following.

"If your app has either App Folder or Full Dropbox permission, you will be able to use the same app key(s) in v2."

Since I am using "App Folder" permission I should be able to use my current key (and secret??).

======================================================
I added a Redirect URI of http://127.0.0.1/ and I now get the Sign in to Dropbox page for my app.

So in summary:

1. App key no longer needs to be put in the Manifest file.
2. App secret is not used anymore.
3. The clientID is the App key.
4. The Redirect URI must be set to http://127.0.0.1
5. Leave accesstoken blank (i.e. dbx.Initialize(Me,"DropBox","",True))

=============================================
The example app crashed after I logged into my Dropbox but I probably need to make some additional changes to the example to get it to work.

Finally progress. Thanks for the updated example.
 
Last edited:
Upvote 0
Top