Dropbox SDK 401 Error
dropbox, iphone, objective-c
Solution
I had the same problem. In my case the problem was that I did set the restClient before the user was connected. In this case the userId is not set and the token is invalid.
My getter for restClient now looks like this:
- (DBRestClient *)restClient
{
if (_restClient == nil) {
if ( [[DBSession sharedSession].userIds count] ) {
_restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
_restClient.delegate = self;
}
}
return _restClient;
}
Problem
I am using the Dropbox SDK and I have it set up so the app can only access the /Apps/MyAPP folder. I was testing it out and deleted the folder online. Now when I'm in the app instead of asking to relink dropbox it gives me a 401 error. I don't know why it doesn't display the view. It was working before I deleted the folder(unlinking the app online). Thank you in advance. PageFlipper[66893:c07] [WARNING] DropboxSDK: error making request to /1/metadata/sandbox - Token is invalid. 2012-08-23 03:10:12.920 PageFlipper[66893:c07] Error loading metadata: Error Domain=dropbox.com Code=401 "The operation couldn’t be completed. (dropbox.com error 401.)" UserInfo=0x23263fe0 {path=/, error=Token is invalid.} ``` -(IBAction)addDropBox:(id)sender{ if (![[DBSession sharedSession] isLinked]) { [[DBSession sharedSession] linkFromController:[self parentViewController]]; } [[self restClient] loadMetadata:@"/"]; restClient = nil; }; ```