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
Anil
8 years agoExplorer | Level 4
Revoke access token
Hi,
I am trying to revoke the token when we trying to logoff the dropbox from my android app.
it always showing some error.
eg:
https://api.dropboxapi.com/2/auth/token/revoke
and set the header as "Authorization: Bearer <access token>"
it would be fine, if you provide the correct url and how to use it android.
Anil.S
You don't need to use DbxRawClientV2. You can use tokenRevoke on DbxClientV2 like this:
DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN); // note: be sure to add error handling client.auth().tokenRevoke();
And if you're using the SDK, you don't need to construct the authorization URL yourself. There's an Android example here that shows how to process the flow in the SDK:
https://github.com/dropbox/dropbox-sdk-java/tree/master/examples/android
Specifically, you start the flow using startOAuth2Authentication:
And finish it in onResume:
- Greg-DBDropbox Staff
What error are you getting?
There's an example of calling that endpoint via curl here in the documentation:
https://www.dropbox.com/developers/documentation/http/documentation#auth-token-revoke
By the way, if you're building an Android app, we recommend using the official Java SDK:
https://www.dropbox.com/developers/documentation/java
In the Java SDK, you would use the tokenRevoke method to revoke a token:
https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.1.x/com/dropbox/core/v2/auth/DbxUserAuthRequests.html#tokenRevoke--- AnilExplorer | Level 4
Thanks Greg.
I used 'DbxClientV2' for getting files and folder list.
Never used the 'DbxRawClientV2' in my application and it seems DbxUserAuthRequests expecting 'DbxRawClientV2' object as parameter.For authentication, i used android native webview control and used the following url.
For eg: https://www.dropbox.com/oauth2/authorize/?client_id=<clientID>&response_type=code&redirect_uri=<redirectURL>And it gives the Accestoken and then set it to the 'DbxClientV2' for listing files.
How can i use the 'DbxUserAuthRequests', please help.
Anil.S
- Greg-DBDropbox Staff
You don't need to use DbxRawClientV2. You can use tokenRevoke on DbxClientV2 like this:
DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN); // note: be sure to add error handling client.auth().tokenRevoke();
And if you're using the SDK, you don't need to construct the authorization URL yourself. There's an Android example here that shows how to process the flow in the SDK:
https://github.com/dropbox/dropbox-sdk-java/tree/master/examples/android
Specifically, you start the flow using startOAuth2Authentication:
And finish it in onResume:
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,915 PostsLatest Activity: 6 years 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!