We Want to Hear From You! What Do You Want to See on the Community? Tell us here!

Forum Discussion

idanarie's avatar
idanarie
Explorer | Level 4
3 years ago

409 Conflict when calling sharing/get_shared_link_metadata

Hi team, we have an OAuth 2 integration with Dropbox (switched from access token integration to OAuth2).

After the authentication, we are sending an API call check/user we get 200 message and everything seems to work.

However, in the next call that we are making using the token we received - 
GET sharing/get_shared_link_metadata we get a conflict error message (409), even though the dropbox document was shared and can be accessed without an issue.

Is there anything that could cause this?

Would appreciate any help

9 Replies

  • Scott-DB's avatar
    Scott-DB
    Icon for Dropbox Staff rankDropbox Staff
    3 years ago

    Hello,

     

    Does the response include any other information than the code? There is likely an error message returned which should explain what the issue is.

     

    Scott

  • idanarie's avatar
    idanarie
    Explorer | Level 4
    3 years ago

    Hi Scott, thanks for the reply.

    I tested it locally on Postman, this is the error I am seeing (even though the link is shared and can be accessed by anyone)

     

    {
        "error_summary": "shared_link_access_denied/.",
        "error": {
            ".tag": "shared_link_access_denied"
        }
    }

     

     

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    3 years ago

    idanarie Are you using an API app registered with the "app folder" access type? There's currently a bug that results in this error when using this method with an access token for an app folder app. That's still open with engineering, but I don't have a timeline on a fix.

  • squdan's avatar
    squdan
    New member | Level 2
    2 years ago

    Hi Greg, there is some new about this error? It's affecting my project also.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    squdan I don't have an update on this case. Are you using an app with the "app folder" access type?

  • squdan's avatar
    squdan
    New member | Level 2
    2 years ago

    Yes, I'll give you all information about my case, maybe there is another way to achieve what I need.

     

    I'm developing a new APP that stores some information into app users dropbox account, this works fine. Also, this app needs to access to a shared folder from my dropbox account to read some files, but I'm getting "SHARED_LINK_ACCESS_ERROR" error when I try to read from app.
    Scoped app (App folder) is automatically set with selected permissions.

    I'm using Java SDK 2.

        public String getPublicFileContent(final String sharedUrl, final String folder, final String filename) {
            String result;
    
            try (final DbxDownloader<SharedLinkMetadata> dropboxSharedLinkFileDownloader = dropboxClient
                    .sharing()
                    .getSharedLinkFileBuilder(sharedUrl)
                    .withPath(getPath(folder, filename))
                    .start()) {
                // Obtain input stream from file
                final InputStream fileInputStream = dropboxSharedLinkFileDownloader.getInputStream();
    
                // Read input stream
                result = new String(fileInputStream.readAllBytes(), StandardCharsets.UTF_8);
            } catch (final DbxException e) {
                log.error("[DROPBOX] Error al accssing public file '{}' - '{}' - '{}'. Error: ", sharedUrl, folder, filename, e);
            } catch (final IOException e) {
                log.error("[DROPBOX] Error reading public file '{}' - '{}' - '{}'. Error: ", sharedUrl, folder, filename, e);
            }
    
            return result.toString();
        }

      Error:

    {
      "cause" : null,
      "stackTrace" : [ {
        "classLoaderName" : null,
        "moduleName" : "java.desktop",
        "moduleVersion" : "17.0.6",
        "methodName" : "run",
        "fileName" : "EventDispatchThread.java",
        "lineNumber" : 90,
        "nativeMethod" : false,
        "className" : "java.awt.EventDispatchThread"
      } ],
      "requestId" : "5bc7ef1fdb6d4731a41186a86e390b3f",
      "userMessage" : null,
      "errorValue" : "SHARED_LINK_ACCESS_DENIED",
      "message" : "Exception in 2/sharing/get_shared_link_file: SHARED_LINK_ACCESS_DENIED",
      "suppressed" : [ ],
      "localizedMessage" : "Exception in 2/sharing/get_shared_link_file: SHARED_LINK_ACCESS_DENIED"
    }

    If there is some error in my configuration or how I try to access to the file, pls tell me.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    squdan Thanks for the information. In order to avoid that error from that method currently, you'd need to use an app registered for the "full Dropbox" access type instead of "app folder".

     

    Alternatively, you can download the entire contents of the shared link by programmatically accessing the shared links directly and setting a relevant URL parameter as noted here, without using the API/SDK. (That is, you would use an HTTPS client of your choice instead of your dropboxClient object.) That would download the whole linked folder as a zip though, so you'd then need to programmatically unzip that and access the desired file from the result.

  • Здравко's avatar
    Здравко
    Legendary | Level 20
    2 years ago

    squdan wrote:

    Yes, I'll give you all information about my case, maybe there is another way to achieve what I need.

    ...


    Hi squdan,

    Yes, As Greg said, there is a bug in current supported set of such API calls. Fortunately, there is undocumented set of API calls too. You can use some of them to achieve what you need. Take a look here for a possible way to list link to folder. 😉 Once you have all entries links, you can download them using any regular download method, as Greg described already. You can get a rough idea how download can be performed here (just translate relevant parts to Java).

    Good luck.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    Update: the /2/sharing/get_shared_link_metadata and /2/sharing/get_shared_link_file endpoints (and corresponding methods in the SDKs) should now work when using an access token for an app with the app folder access type.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,033 PostsLatest Activity: 3 years ago
409 Following

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!