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

strugglingstudent's avatar
strugglingstudent
New member | Level 2
4 years ago

Invalid_access_token with the android example app

I am trying to run the Android example app in the api v2 Github repo. I followed exactly what the README section mentioned, the app successfully run. But after I log in, I can view my files, but when I click on a file to view it (a txt file), I got this error

E/com.dropbox.core.examples.android.FilesActivity: Failed to download file.
    com.dropbox.core.InvalidAccessTokenException: {"error_summary": "missing_scope/..", "error": {".tag": "missing_scope", "required_scope": "files.content.read"}}

That error also happen when I try to upload file. Please explain how I can fix this, this is my first project so I am very inexperienced with Java/Android programming.

  • Здравко's avatar
    Здравко
    4 years ago

    Hi strugglingstudent,

    I am not sure still what application you are trying to build and run (you didn't share a link to yet). One more thing you should take care about is what are scopes you have queried at moment of authentication (at runtime). Even when you have enabled all available scopes at application creation time, those scopes are available for application key only. When you recieve authentication token (the one actually used by Dropbox API), its scopes set is a subset of application key set (not mandatory entire - i.e. you can query at run time only 2 scopes from all available, for example). Make sure you have queried all scopes too (all needed, at least) on token query time!

    Hope this gives right direction.

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

    Hi strugglingstudent,

    The error message is self explanatory enough. 😉 Did you add in your set of scopes all needed scopes at the application creation time? 🧐 Seems not. In the particular case, the error shows you that the "files.content.read" scope is missing. Just be more careful on application creation! 🙂

    Hope this helps.

  • strugglingstudent's avatar
    strugglingstudent
    New member | Level 2

    Hi @,

    For more information, I enabled all the necessary scopes, detele the app, reinstall, login again, and that error still exist! I'm not sure what I did is 'You'd need to process the authorization flow (either the OAuth flow or using the "Generate" button on the app's page on the App Console) again to authorize an access token with any newly enabled scopes. Please refer to the OAuth Guide for information on scopes.' If i am not correct, please explain how I can do this.

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

      strugglingstudent wrote:

      For more information, I enabled all the necessary scopes, detele the app, reinstall, login again, and that error still exist! ...


      Hi strugglingstudent,

      What you mean "that error still exist"? Do you mean that "files.content.read" scope is missing still, despite you have added in the just created application? 🤔 If so, that would be really strange. Take a look more carefully and see what exactly error appear. Make sure that you have authenticated the application instance with the just created application credentials (app key and secret) and not the old!

      The error you have posted in OP shows only missing scopes, nothing more. If something else comes up, post it. For now, everything else seems Ok.

      Good luck.

       

      Seems your post got in the forum trash.


      strugglingstudent wrote:

      When I reinstall the application, it requires me to authenticate the app again, which I did. And I can view my files as a list, upload new files. ...


      You have authenticated, but how?! 👆 When you reauthenticate after application reinstall, actually you get an new authentication token based on your app key and secret. Did you make sure you did use correct application key and secret and not the old? 🤔 That's not clear! You can see this too in the authentication browser view (the application identification). Is it correct?

      • strugglingstudent's avatar
        strugglingstudent
        New member | Level 2

        Dear @

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API

Make connections with other developers

795 PostsLatest Activity: 12 hours ago
193 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!