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
vinke
3 years agoExplorer | Level 4
/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...
- 3 years ago
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.
Greg-DB
Dropbox 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
3 years agoExplorer | 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-DB3 years agoDropbox 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.
- vinke3 years agoExplorer | Level 4
thanks for the information!
I didnt know i have to refresh the token after changing/adding a scope 🙂
- Здравко3 years agoLegendary | Level 20
vinke wrote: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.
...
No, the access token could be used for all regular API calls (wherever needed). Is you are using the same token? Only you know this!
vinke wrote:...
Response:HTTP/1.1 401 Unauthorized returned for "https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings"
...
The above is not a body!!! This is first line of the response, actually (far from the body).
ADD: Try the call here with the same token. You can easy get the body out from response field. 😉
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,915 PostsLatest Activity: 2 hours agoIf 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!