Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

mattcmf's avatar
mattcmf
New member | Level 2
9 years ago
Solved

Invalid access token when generating new token after revoke() API V2

I am getting a "invalid_access_token" when trying to generate a new token, after the first token has been revoked, e.g. log out, then log back in again. I am using API V2 on Android.

 

First

DropboxClientFactory.init(XYZ.getApiToken());
DbxClientV2 dbxClientV2 = DropboxClientFactory.getClient();
dbxClientV2.auth().tokenRevoke();

 

Then running through the oAuth flow again and obtaining the new (verified as different token) and finally calling:

DropboxClientFactory.init(Auth.getOAuth2Token());
DbxClientV2 dbxClientV2 = DropboxClientFactory.getClient();
dbxClientV2.users().getCurrentAccount()

I hit the invalid access token.  

 

The first pass works fine, but after I revoke and regenerate I am stuck in a loop as the oAuth keeps failing.

  • Resolved this myself using the solution from here:

    https://github.com/dropbox/dropbox-sdk-java/issues/92

     

    (Specifically steps 3 and 4).

    The documentation is very unclear on the flow for re-authentication for API 2, in addition the sample project does not contain an example of how to use revoke token. May I suggest that the documentation is updated to reflect the hotfix mentioned in the github post?

2 Replies

Replies have been turned off for this discussion
  • mattcmf's avatar
    mattcmf
    New member | Level 2
    9 years ago

    Resolved this myself using the solution from here:

    https://github.com/dropbox/dropbox-sdk-java/issues/92

     

    (Specifically steps 3 and 4).

    The documentation is very unclear on the flow for re-authentication for API 2, in addition the sample project does not contain an example of how to use revoke token. May I suggest that the documentation is updated to reflect the hotfix mentioned in the github post?

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago
    Thanks! I'll ask the team to update the documentation.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

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, Facebook or Instagram.

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!