如何从Dropbox Sync& amp;获取访问令牌数据存储xamarin组件

时间:2015-05-21 07:15:16

标签: ios xamarin xamarin.ios dropbox dropbox-api

我尝试从Dropbox Sync& amp;获取访问令牌Xamarin iOS项目中的数据存储xamarin组件。我使用dropnet获取访问令牌,但我得到了一个http异常:(让我知道我在哪里做错了

 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)
        {
        }
    }

0 个答案:

没有答案
相关问题