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
Steve L.32
8 years agoExplorer | Level 4
Dropbox authentication on iPhone X
My App's Dropbox authentication is failing on iPhone X and iOS 11. I still do not know the root cause and am just doing an initial inquiry here to learn if there is a known issue. What I can say is ...
- 8 years agoThanks for digging in and tracking this down already! I'm glad to hear you figured this out. Calling authorizeFromController twice would indeed cause this. Enforcing a single call is the right thing to do given the unexpected viewDidAppear behavior.
Steve L.32
Explorer | Level 4
Wasn't finished with last post, continuing:
I assume the real problem is that extractfromDAuthURL:url is called twice and thus the stored nonce doesn't match the current nonce. Also, I munged the redaction in the log entries previously, so here they are again.
2017-11-11 17:32:29.380496-0500 Krypton[3454:894607] DBSDKReachability Flag Status: -R ------- networkStatusForFlags 2017-11-11 17:32:30.189937-0500 Krypton[3454:894607] didEnterBackground 2017-11-11 17:32:30.205156-0500 Krypton[3454:894607] DBSDKReachability Flag Status: -R ------- networkStatusForFlags 2017-11-11 17:32:30.532935-0500 Krypton[3454:894607] [Snapshotting] Snapshotting a view (0x104005c00, UIKeyboardImpl) that is not in a visible window requires afterScreenUpdates:YES. 2017-11-11 17:32:31.573593-0500 Krypton[3454:894607] willEnterForeground 2017-11-11 17:32:31.590287-0500 Krypton[3454:894607] in viewwillappear call randomizecombination 2017-11-11 17:32:31.646979-0500 Krypton[3454:894607] handling URL: db-***://1/connect?oauth_token_secret=***&state=oauth2%3A9C3186A0-0DAF-48F3-8D70-F98E86DBE839&uid=***&oauth_token=oauth2%3A 2017-11-11 17:32:31.647129-0500 Krypton[3454:894607] stored nonce: 9B60EAE8-003D-40D6-AEF7-4BC8620372C8 2017-11-11 17:32:31.647267-0500 Krypton[3454:894607] Auth Error: Error:[ErrorType: 6 ErrorDescription: Unable to verify link request.] 2017-11-11 17:32:31.648096-0500 Krypton[3454:894607] handling URL: db-***://1/connect?oauth_token_secret=***&state=oauth2%3A9C3186A0-0DAF-48F3-8D70-F98E86DBE839&uid=***&oauth_token=oauth2%3A 2017-11-11 17:32:31.648217-0500 Krypton[3454:894607] stored nonce: 9B60EAE8-003D-40D6-AEF7-4BC8620372C8 2017-11-11 17:32:31.648301-0500 Krypton[3454:894607] Auth Error: Error:[ErrorType: 6 ErrorDescription: Unable to verify link request.]
Thus we see that the stored nonce is not the same as what's presented in the URL. This is on iPhone X only, on iPad Air 2 those data match and authentication succeeds. I will continue to see if I've broken my own code with iPhone X mods, but it's not obvious that they could have any impact ... famous last words, eh?!
Again, I see the log message DBSDKReachability twice for iPhone X but once for iPad. I also see the call to extractfromDAuthURL:url twice for iPhone X but only once for iPad.
And NOW I figured it out: for iPhone X I am calling authorizeFromController:controller:openURL twice! When I artificially limit the call to just once authentication works. The call in inside viewDidAppear:animated. For iPad the view must not disappear when the Dropbox App is run, but for iPhone X there is a second call to viewDidAppear:animated which I do not understand.
Now off to grok some more on what to do ....
Thanks!
Greg-DB
8 years agoDropbox Staff
Thanks for digging in and tracking this down already! I'm glad to hear you figured this out. Calling authorizeFromController twice would indeed cause this. Enforcing a single call is the right thing to do given the unexpected viewDidAppear behavior.
- Steve L.328 years agoExplorer | Level 4
I've restructured the Dropbox authentication flow slightly in light of the iPhone / iPad differences I found. I’ve used Dropbox in this App since 2011, so I’m surprised I didn’t see this issue earlier, although I must note that the viewDidAppear:animated code was added 2017.05.22 - this was my great API 1 --> API 2 commit! This Dropbox App vs. Dropbox web authentication issue might have really existed for the last 6 months and I never noticed it. I’ll have a definitive answer whenever I can borrow a non-iPhone X and see if viewDidAppear:animated is invoked once or twice.
Thanks again for your help.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,889 PostsLatest Activity: 6 hours 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!