Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dropbox SDK 401 Error

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;
};
like image 339
BDGapps Avatar asked Aug 23 '12 07:08

BDGapps


People also ask

How do I fix a Dropbox error?

To resolve issues with your web browser, you can try the following: Ensuring your browser is compatible with dropbox.com, or updating to a compatible version of your browser. Signing in to dropbox.com using a different web browser (like Apple Safari, Google Chrome, or Mozilla Firefox) Clearing your browser's cache.

How do I fix Error 404 on Dropbox?

Does the shared link open in your browser? If you click a shared link and it won't open, you may be encountering a browser issue. To correct this, sign out of Dropbox and click the shared link again.

Does Dropbox have an API?

The Dropbox API v2 is a set of HTTP endpoints that help your app integrate with Dropbox. Check out our full HTTP documentation to learn about everything you can do with the API. We recommend that you use one of our officially supported SDKs.


1 Answers

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;
}
like image 141
freytag Avatar answered Sep 20 '22 00:09

freytag