public void PasswordAuth(string username, string password, out Dictionary<string, string> contents, out WebHeaderCollection headers) { string xAuthQuery = "x_auth_mode=client_auth&x_auth_username="******"&x_auth_password=" + UrlEncode (password); using (HttpWebResponse response = GetResponse (_xauthUri, HTTP_POST, null, null, null, xAuthQuery, null)) { using (StreamReader reader = new StreamReader (response.GetResponseStream (), Encoding.ASCII)) { contents = ParseSimple (reader.ReadToEnd ()); } headers = response.Headers; } if (!contents.ContainsKey (OAuthTokenKey) || !contents.ContainsKey (OAuthTokenSecretKey)) throw new Exception (); _credential = new OAuthPasswordCache (username, password, contents[OAuthTokenKey], contents[OAuthTokenSecretKey]); }
public void InputPIN(string pin, out Dictionary<string, string> contents, out WebHeaderCollection headers) { if (_requestTokenSecret == null) throw new Exception (); using (HttpWebResponse response = GetResponse (_accessTokenUri, HTTP_GET, _requestToken, _requestTokenSecret, pin, null, null)) { using (StreamReader reader = new StreamReader (response.GetResponseStream (), Encoding.ASCII)) { contents = ParseSimple (reader.ReadToEnd ()); } headers = response.Headers; } if (!contents.ContainsKey (OAuthTokenKey) || !contents.ContainsKey (OAuthTokenSecretKey)) throw new Exception (); _credential = new OAuthCredentialCache (contents[OAuthTokenKey], contents[OAuthTokenSecretKey]); }