public OAuthMessageHandler(HttpMessageHandler handler, string apiKey, string appSecret, UserLogin login)
            : base(handler)
        {
            _apiKey = apiKey;
            _appSecret = appSecret;

            _login = login;
            _authBase = new OAuthBase();
        }
Esempio n. 2
0
        public void Given_A_Login_Details_And_CallBack_Url_Then_Create_Authorisation_Url()
        {
            using (var client = new Client())
            {
                var user = new UserLogin("h85b2dyc1018zjp", "8zvszrc4mncrebf");
                string url = client.CreateAuthoriseUrl(user, "http://www.cloudyboxapp.com");

                Debug.WriteLine(url);
                Assert.IsNotNull(url);
            }
        }
Esempio n. 3
0
        static UserLogin GetUserLoginFromParams(string urlParams)
        {
            var userLogin = new UserLogin();

            var parameters = urlParams.Split('&');

            foreach (var parameter in parameters)
            {
                switch (parameter.Split('=')[0])
                {
                    case "oauth_token_secret":
                        userLogin.Secret = parameter.Split('=')[1];
                        break;
                    case "oauth_token":
                        userLogin.Token = parameter.Split('=')[1];
                        break;
                }
            }

            return userLogin;
        }
Esempio n. 4
0
 /// <summary>
 /// Sets the user login to handler.
 /// </summary>
 /// <param name="login">The login.</param>
 public void SetUserLoginToHandler(UserLogin login)
 {
     _messageHandler.SetLogin(login);
 }
Esempio n. 5
0
 /// <summary>
 /// Creates the authorise URL.
 /// </summary>
 /// <param name="login">The login.</param>
 /// <param name="callbackUrl">The callback URL.</param>
 /// <returns>Authorisation Url</returns>
 public string CreateAuthoriseUrl(UserLogin login, string callbackUrl = null)
 {
     return string.Format("https://www.dropbox.com/1/oauth/authorize?oauth_token={0}{1}", login.Token,
         (string.IsNullOrEmpty(callbackUrl) ? string.Empty : "&oauth_callback=" + callbackUrl));
 }
 public void SetLogin(UserLogin login)
 {
     _login = login;
 }