private static OAuthToken GetAccessToken()
        {
            var oauth = new OAuth();

            var requestToken = oauth.GetRequestToken(new Uri(DropboxRestApi.BaseUri), ConsumerKey, ConsumerSecret);

            var authorizeUri = oauth.GetAuthorizeUri(new Uri(DropboxRestApi.AuthorizeBaseUri), requestToken);
            Process.Start(authorizeUri.AbsoluteUri);
            Thread.Sleep(5000); // Leave some time for the authorization step to complete

            return oauth.GetAccessToken(new Uri(DropboxRestApi.BaseUri), ConsumerKey, ConsumerSecret, requestToken);
        }
Esempio n. 2
0
        public OAuthToken GetAccessToken()
        {
            var oauth = new OAuth();

            var requestToken = oauth.GetRequestToken(new Uri(DropboxRestApi.BaseUri), DropboxProperties.consumerKey, DropboxProperties.consumerSecret);
            DropboxProperties.Properties.oauthToken = requestToken.Token;
            DropboxProperties.Properties.oauthTokenSecret = requestToken.Secret;

            var authorizeUri = oauth.GetAuthorizeUri(new Uri(DropboxRestApi.AuthorizeBaseUri), requestToken);

            LoginPage.Site = StorageServices.Dropbox;
            LoginPage.SigningIn = true;

            LoginPage window = new LoginPage();
            window.ShowDialog();

            return oauth.GetAccessToken(new Uri(DropboxRestApi.BaseUri), DropboxProperties.consumerKey, DropboxProperties.consumerSecret, requestToken);
        }