cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Invalid_access_token with the android example app

Invalid_access_token with the android example app

strugglingstudent
New member | Level 2
Go to solution

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.

1 Accepted Solution

Accepted Solutions

Здравко
Legendary | Level 20
Go to solution

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.

View solution in original post

5 Replies 5

Здравко
Legendary | Level 20
Go to solution

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
New member | Level 2
Go to solution

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.

Здравко
Legendary | Level 20
Go to solution

@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
New member | Level 2
Go to solution

Dear @

Здравко
Legendary | Level 20
Go to solution

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.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    strugglingstudent New member | Level 2
What do Dropbox user levels mean?