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

VyacheslavB's avatar
VyacheslavB
Helpful | Level 5
5 years ago

When I try to get a list of files I get a nil in response (Swift 5)

I have a simple method where I want to get a list of the user's files. I took the implementation of this method from your PhotoWatch example. I also added a print at each step to track each step. But when I try to get a response, I get a nil. What's wrong? This user definitely has files in his Dropbox.

I would be grateful for help.

  • Greg-DB's avatar
    Greg-DB
    5 years ago

    You just need to create the ScopeRequest object before calling the authorizeFromControllerV2 method.

     

    As for the error, make sure you're only calling the authorizeFromControllerV2 method once. In your screenshot, I see you're calling authorizeFromControllerV2, and then are also calling a method of your own called "openDropboxAutorization". Are you also calling an authorize method from inside "openDropboxAutorization" by any chance?

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    The response method is given both a "response" and "error" object. If "response" isn't set, you should check "error" to see what went wrong with the call.

    • VyacheslavB's avatar
      VyacheslavB
      Helpful | Level 5

      I handled the error, the problem was with individual scopes. I have selected the options I want and now I get another error.

      API auth error - {
      ".tag" = "missing_scope";
      "required_scope" = "files.metadata.read";
      }

       

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        The 'missing_scope' error indicates that while the app is permitted to use that scope, the particular access token you're using to make the API call does not have that scope granted. Adding a scope to your app via the App Console does not retroactively grant that scope to existing access tokens.

         

        That being the case, to make any API calls that require that scope, you'll need to get a new access token with that scope.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,910 PostsLatest Activity: 3 days ago
333 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!