Alibaba
Alibaba

Reputation: 352

DropBox IOS SDk retrieving access token and secret is invalid once user is Authenticated

Cross authentication of a dropbox user using Access token and secret not happening.

Elaborating my Question:

  1. authenticate the user in my IOS app
  2. In Ios app , I retrieve access token and secret from MPOAuthCredentialConcreteStore *credentials.
  3. get the access token from credentials->acccessToken and similarly the secret.

  4. Now if I feed these values into another app outside IOS which uses python sdk for dropbox. I get a error message "Invalid token".

But, interestingly the reverse process from step 1 to 4 works. i.e get access token and secret from python SDK and feed it to my IOS app by using

[dbSession updateAccessToken:@"xxxxxxxxx" accessTokenSecret:@"YYYYYYYYYYY" forUserId:@"12345678"];

and now i can assess user's dropbox account. Any idea as to whats going wrong? Is there a difference between MPoauth and Oauth? I believe MPoauth is just a wrapper right?

is there any other way to get the access token and secret?

Thanks for the help.

Upvotes: 3

Views: 1323

Answers (2)

Pandian
Pandian

Reputation: 11

You can get your Access token by using this delegate

(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *) url {

    if ([[DBSession sharedSession] handleOpenURL:url]) { 
        if ([[DBSession sharedSession] isLinked]) { 
            // At this point you can start making API calls

            NSLog(@"App linked successfully!");

        }
        // Add whatever other url handling code your app requires here 
     } 

     return NO;
 }

Given url has Access token, secret token and user id

Upvotes: 1

Alibaba
Alibaba

Reputation: 352

I found a fix for this. It was a simple error. Basically the editor I was using was adding a new line char at the end. For some one stuck at the same problem make sure you dont have a new line char at the end.

Upvotes: 1

Related Questions