You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

VikasGarg_cs's avatar
VikasGarg_cs
Explorer | Level 3
6 years ago

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

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

  • VikasGarg_cs's avatar
    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's avatar
      Greg-DB
      Icon for Dropbox Staff rankDropbox 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's avatar
        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