There seems to be an authentication that might randomly happen the first time the app links to dropbox. (it happened in 2 out of 6 tries). However it seems to work correctly if the app is restarted.
The flow is, Link to dropbox, when successful and when the focus returns to my app, i try uploading a file, then I get the following error:
2015-10-16 19:29:50.499 appName[300:29495] [WARNING] DropboxSDK: error making request to /1/files_put/auto/Backup (2015-10-16 at 1929).zip - (401) Authentication failed
2015-10-16 19:29:50.499 appName[300:29495] File upload failed with error: Error Domain=dropbox.com Code=401 "(null)" UserInfo={sourcePath=/private/var/mobile/Containers/Data/Application/9357CDDE-0F42-4AE5-B5AD-7151BA370FC5/tmp/Backup (2015-10-16 at 1929).zip, destinationPath=/Backup (2015-10-16 at 1929).zip, error=Authentication failed}
2015-10-16 19:29:50.500 appName[300:29495] File upload failed with error (localized): The operation couldn’t be completed. (dropbox.com error 401.)
Also if i try requesting metadata i get this error:
2015-10-16 19:29:59.107 appName[300:29495] [WARNING] DropboxSDK: error making request to /1/metadata/auto - (400) invalid_request
2015-10-16 19:29:59.108 appName[300:29495] Error loading metadata: Error Domain=dropbox.com Code=400 "(null)" UserInfo={error_description=No auth function available for given request, path=/, error=invalid_request}
-------------------
However this is strange because it should ALREADY be linked, since i check it before performing the requests like this:
if (![[DBSession sharedSession] isLinked]) {
return;
}
By the way, i followed everything written on this guide: https://www.dropbox.com/developers-v1/core/start/ios
And as mentioned earlier, the weird thing is that, it might or might not happen the first time it is linked. So its kind of hard to replicate. Last time it happened, i closed the app, re-opened and it was suddenly fixed.