cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: 

Cannot access dropbox account using access Token generated by a different account

Cannot access dropbox account using access Token generated by a different account

VikasGarg_cs
Explorer | Level 3

I have given an appkey to access a dropbox app, I create an authorize url using this - 

Uri authorizeUri = DropboxOAuth2Helper.GetAuthorizeUri(OAuthResponseType.Token, AppKey, RedirectUri, state: oauth2State);

Then once the authorize Uri generated, I used this to generate access Token by browsing the url and providing my dropbox credentials (dropbox belong to some organization account).

Now the access token generated and I am trying to read the files, upload the files, view the files/folders then I am getting path not found. Therefore not sure this access token is accessing which path.

 

Note: I generated the access toke with my dropbox account with above process and I can do all operation under Apps/<App Folder>.

 

I am not getting help related to this, all i need is simple explanation with few lines of code.

 

Thanks.

Vikas Garg

6 Replies 6

VikasGarg_cs
Explorer | Level 3

Using c# Desktop application for downloading files from Dropbox.

I have given an appkey to access a dropbox app, I create an authorize url using this - 

Uri authorizeUri = DropboxOAuth2Helper.GetAuthorizeUri(OAuthResponseType.Token, AppKey, RedirectUri, state: oauth2State);

Then once the authorize Uri generated, I used this to generate access Token by browsing the url and providing my dropbox credentials (dropbox belong to some organization account).

Now the access token generated and I am trying to read the files, upload the files, view the files/folders then I am getting path not found. Therefore not sure this access token is valid or having access to read/write in the app folder.

 

Note: I generated the access toke with my own dropbox account with above process and I can do all operation under Apps/<App Folder>, with same code.

 

I am not getting help related to this, all i need is simple explanation with few lines of code and correction required.

 

Thanks.

Vikas Garg

Greg-DB
Dropbox Staff

Each Dropbox API access token is specific to a particular app-user pair, and enables access to that particular account to the extent allowed by the app's access type (a.k.a. "permission"). For example, if the app is registered for the "app folder" permission, it will only be able to access the contents of the app folder created for the app in that user's account.

By default, app folders are created at "/Apps/<app folder name>". When using an access token for an app with the app folder permission though, the app should not include the "/Apps/<app folder name>" part of the path in paths it sends to the API. Dropbox will automatically interpret paths as being inside the app folder.

Also, note that each account gets its own app folder when it connects to an app with the app folder permission. App folders for the same app do not sync their contents across different accounts.

If you're making an API call and are getting a 'not_found' error, it indicates that there isn't anything at the "path" you supplied in the connected account. You should check what path you actually meant to specify, and send the correct value instead. 

It may help to use the ListFolderAsync/ListFolderContinueAsync methods to list the root first, by supplying a path of "" (the empty string).

VikasGarg_cs
Explorer | Level 3

Thanks for the quick response.

Here is my understanding - 

1. Each dropbox account generate its own access token.

2. Each dropbox account will create its own folder under the "Apps/<App Folder name>"

3. Different accounts cannot access each other folder

3. Account folders cannot communicate/synch with each other.

Now let me explain you my scenario - 

1. There is one parent company who created an App with App folder permission with folder say Apps/InputData

2. Another company will be uploading the files from their application to the InputFolder as mentioned above <Not sure how they will do that as I don't connect with them>

3. My job is to connect to the dropbox copy the uploaded file to the local folder, read/process the information uploaded.

Now the question is if they are uploading to a different folder which i cannot read then how to achieve this.

 

Thanks

Greg-DB
Dropbox Staff

With an access token for an app folder in a particular account, you can access anything in that app folder. You will need to specify the correct path though. A 'not_found' error indicates that you're not specifying the correct path. You cannot access anything outside that app folder though.

I recommend first using the ListFolderAsync/ListFolderContinueAsync methods to list the root of the app folder, by supplying a path of "" (the empty string). The result will show you the contents of the app folder (if any), including the path value for each item inside it. You can then use the paths for the files/folders in the app folder to access them.

If they did not upload files inside the app folder, you'll need to either have them move the files into the app folder manually, or switch to an API app with the "full Dropbox" permission. Unlike apps with the "app folder" permission, apps with the "full Dropbox" permission can access anything in the connected Dropbox account.

VikasGarg_cs
Explorer | Level 3
Thanks Greg.
I figured based on your response that path not found is coming due to the fact that I uploaded the files from different account/apptoken and downloading the files from different account/apptoken.

As you mentioned that different account will have separate folder there for no possibility if communication with folder access permissions.

I need to request full dropbox access and try that out today.

Further the folder contents Api you mentioned I already check earlier but the folder, files were different therefore cannot relate them.

I will try full dropbox access app and update you on that.

Thanks

VikasGarg_cs
Explorer | Level 3

I tried drobox app with full dropbox permission. Given below are my findings - 

Admin/Owner of the dropbox uploaded the files to the 'Apps/Input' folder manually with thier own account and from the dropbox web interface.

I have given with the appkey of the new dropbox app as mentioned above.

Now, I generated an app Token using my own dropbox account for the above app and tried reading the files and found that I cannot access the files uploaded by owner with my app Token, regardless I use full dropbox or folder only permission.

Seems like If 3 different people wants to read/write same folder in a dropbox app then app Key/Token has to be same/shared among all i.e. this is only possible with same appToken used for read/write/access.

What I can do is create a folder outside an App, this folder to be shared among 3 parties as shared folder. Now each one of us can view/read/write this folder in our own dropbox. Further this folder is accessible to everyone. I tested this and this seems to be working.

Thanks.

Vikas Garg

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    VikasGarg_cs Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?