0

I trying get an access token from Dropbox Sync & Datastore xamarin component in Xamarin iOS project.I have used dropnet to get the access token but I'm getting an http exception :( let me know where I'm doing wrong

 private static void GetAccessToken()
    {
        try
        {

            const string DropboxSyncKey = "XXXXXXXX";
            const string DropboxSyncSecret = "XXXXXX";
           //this url is obtained fromDBAccountManager.SharedManager.HandleOpenURL(url);
            string token = "db-XXXXXX://1/connect?oauth_token_secret=XXXXXXX&state=xXXXXXXX&uid=XXXXXX&oauth_token=xXXXXXXXX";
            token = token.Substring(token.LastIndexOf("&") + 13);
            string stoken = "db-XXXXXX://1/connect?oauth_token_secret=XXXXXXX&state=xXXXXXXX&uid=XXXXXX&oauth_token=xXXXXXXXX";
            int indexof = stoken.IndexOf("?") + 20;
            int lastindex = stoken.IndexOf("&") - indexof;
            string secrettoken = stoken.Substring(indexof, lastindex);
            var client = new DropNetClient(DropboxSyncKey, DropboxSyncSecret, token, secrettoken);
            var accesskey = client.GetAccessToken();
            Console.WriteLine(token);
            Console.WriteLine(secrettoken);
            Console.WriteLine(accesskey);
        }
        catch (Exception)
        {
        }
    }
10
  • What's the actual exception you get?
    – user94559
    Commented May 21, 2015 at 14:55
  • Also, I don't think you want to call GetAccessToken. You already have the OAuth token and secret, so you should be able to just start using the client. E.g. client.Account_Info()
    – user94559
    Commented May 21, 2015 at 15:25
  • I'm getting object reference not set to instance exception so i have used this code ` DropNetClient client = new DropNetClient(apikey, apisecretkey, usertoken, usersecrettoken);` still the same exception. Commented May 21, 2015 at 16:52
  • Please share the full exception, including the stack trace.
    – user94559
    Commented May 21, 2015 at 17:05
  • I have resolved the object reference exception now i got this one DropBoxIntegration[3831:508119] Stack Trace at DropNet.DropNetClient.Execute (ApiType apiType, IRestRequest request) [0x0002c] Commented May 22, 2015 at 8:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.