We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here. 

Forum Discussion

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

/sharing/create_shared_link_with_settings unauthorized

Hello,

 

im trying to create a shared link with /sharing/create_shared_link_with_settings. Despite having the sharing.write set to my App, i get unauthorized all the time.

 

What am i missing here?

  • vinke Please print out the response body, as it should contain a more useful error message.

     

    While access tokens can be used to access multiple different endpoints, different endpoints do require different scopes, so it's possible that an access token can access one endpoint but not another.

     

    Also, be aware that just adding a scope to your app via the App Console does not retroactively grant that scope to existing access tokens. That being the case, to make any API calls that require that scope, you'll need to get a new access token with that scope. For example, if the access token you're using was not originally created with the "sharing.write" scope, just enabling the "sharing.write" scope on the app itself will not automatically add "sharing.write" to that particular access token, so you'd need to get a new access token for that.

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

    Hi vinke,

    Are you certain access token in use is up to date and not expired? Once generated, its validity (without refresh) prolong to 4 hours, at most!

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

    I'll be happy to help with any issues you're having with the Dropbox API, but I'll need some more information. Please reply with:

    • the name and version number of the platform and SDK/library you are using, if any
    • the steps to reproduce the issue, including relevant code snippet(s), but don't include any access or refresh token(s)
    • the full text of any error or unexpected output from the API (be sure to print out the response body)
    • vinke's avatar
      vinke
      Explorer | Level 4

      does the access token for this endpoint differ?

      I am using the generated one from the App which is working fine for the endpoint /files/search_v2 for example.
      I am not using an SDK, i am using symfony (PHP) and im using the HttpClientInterface to send the request.

      As said, its working for the endpoint /files/search_v2 without any problems.

      Response: 

      HTTP/1.1 401 Unauthorized returned for "https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings"

       

      Same headers set as for /files/search_v2 which is working fine

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

        vinke Please print out the response body, as it should contain a more useful error message.

         

        While access tokens can be used to access multiple different endpoints, different endpoints do require different scopes, so it's possible that an access token can access one endpoint but not another.

         

        Also, be aware that just adding a scope to your app via the App Console does not retroactively grant that scope to existing access tokens. That being the case, to make any API calls that require that scope, you'll need to get a new access token with that scope. For example, if the access token you're using was not originally created with the "sharing.write" scope, just enabling the "sharing.write" scope on the app itself will not automatically add "sharing.write" to that particular access token, so you'd need to get a new access token for that.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,876 PostsLatest Activity: 3 hours ago
325 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!