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
5 years agoHelpful | Level 5
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...
- 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
Dropbox Staff
When enabling a new scope for an app, make sure you click the "Submit" at the bottom of the page, or else the changes won't take effect.
And, when configuring the app authorization flow, be sure to specify the particular scopes you want to request. When using SwiftyDropbox, that's done by making a ScopeRequest object with the desired scopes in the "scopes" parameter, and passing that to authorizeFromControllerV2 as shown here. That example only includes "account_info.read", but you would want to add "files.metadata.read" to that list, for example.
VyacheslavB
5 years agoHelpful | Level 5
At what moment should I create a ScopeRequest object?
I try to do this in the Action of the Login button, but at the time of authorization after clicking Alloy, I receive an Error: Optional("Auth flow failed because of inconsistent state.")
- Greg-DB5 years agoDropbox Staff
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?
- VyacheslavB5 years agoHelpful | Level 5
Yes, you are right, I created ScopeRequest twice. Sorry for my carelessness. I finally got a list of files! I am very glad)) Thank you very much for your help!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days agoIf 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!