Forum Discussion

mattcmf's avatar
mattcmf
New member | Level 2
8 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?

  • mattcmf's avatar
    mattcmf
    New member | Level 2

    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 Staff rankDropbox Staff
      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.5,950 PostsLatest Activity: 2 hours ago
352 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!