Forum Discussion

kpanwala's avatar
kpanwala
New member | Level 2
8 years ago

Invalid_request: No auth function available for given request

Hi,

 

i am getting invalid request when i am trying to authorize for my app using following URL:

curl -X POST "https://<APP_KEY>:<APP_SECRET>@api.dropbox.com/1/metadata/link" \
    -d link="https://www.dropbox.com/sh/748f94925f0gesq/AAAMSoRJyhJFfkupnAU0wXuva?dl=0"

Response:

{
"error_description": "No auth function available for given request",
"error": "invalid_request"
}

 

Can you please suggest what am i doing wrong here?

 

i am using SOAPUI tool to validate the request.

 

Thanks, 

Kinjal Panwala

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff
    Hi Kinjal, the curl code you posted works for me when I put in an app key and secret.

    It sounds like the tool you're using isn't producing a valid request. Note that the Dropbox API isn't a SOAP API though, so that tool may not work for it.

    Can you share the actual request it's producing?
    • kpanwala's avatar
      kpanwala
      New member | Level 2

      Thanks for the updates, Greg.

       

      Actually, I am trying to access\authenticate data file from DropBox before downloading it & need to do this in javascript.

       

      I can actually download the data files without authentication but looking for a request that autheicates the file with APP Key and Secret provided in URL & then downloads the file..

       

      Let me know if this helps to undestand the requirement.

       

      Thanks,

      Kinjal 

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        Do you mean you want to call /1/metadata/link from JavaScript? I just tried that out, and got it to work like this:

         

        $.ajax({
            url: 'https://api.dropbox.com/1/metadata/link',
            type: 'POST',
            data: {'link': "https://www.dropbox.com/sh/748f94925f0gesq/AAAMSoRJyhJFfkupnAU0wXuva?dl=0"},
            headers: {
                "Authorization": "Basic <base64(APP_KEY:APP_SECRET)>"
             },
            success: function(data) {
                console.log(data);
            },
            error: function(data) {
                console.error(data);
            }
        })
        

         

        Be sure to replace the <base64(APP_KEY:APP_SECRET)> with your base64 encoded app key and secret, as covered here:

         

        https://www.dropbox.com/developers/reference/auth-types#app

         

        (The technique of putting the app key and secret in the URL doesn't seem to work in JavaScript.)

         

        Also, note that API v1, such as this endpoint, is deprecated:

         

        https://blogs.dropbox.com/developers/2016/06/api-v1-deprecated/

         

        You should migrate to API v2:

         

        https://www.dropbox.com/developers 

         

        The equivalent endpoint in API v2 is /2/sharing/get_shared_link_metadata. That doesn't support app authentication though.

         

        Using that in JavaScript would look like:

         

        $.ajax({
            url: 'https://api.dropboxapi.com/2/sharing/get_shared_link_metadata',
            type: 'POST',
            processData: false,
            data: JSON.stringify({"url": "https://www.dropbox.com/sh/748f94925f0gesq/AAAMSoRJyhJFfkupnAU0wXuva?dl=0"}),
            contentType: 'application/json',
            headers: {
                "Authorization": "Bearer <ACCESS_TOKEN>"
            },
            success: function(data) {
                console.log(data);
            },
            error: function(data) {
                console.error(data);
            }
        })  

         

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,945 PostsLatest Activity: 2 hours ago
351 Following

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!