Ejemplo n.º 1
0
        public Response Connect()
        {
            var   request_url = "https://api.twitter.com/oauth/request_token";
            Twitt empty       = new Twitt()
            {
                Text = "", Media = null
            };
            var response = SendPOSTRequest(empty, request_url);

            OauthMembers set = new OauthMembers(response.Text);

            // oauth token
            this.oauth_token        = set.oauth_token;
            this.oauth_token_secret = set.oauth_token_secret;

            string verifier_url = "https://api.twitter.com/oauth/authorize?oauth_token=" + oauth_token;

            System.Diagnostics.Process.Start(verifier_url);

            return(response);
        }
Ejemplo n.º 2
0
        public Response SetToken(string oauth_verifier)
        {
            Response resp = new Response();

            if (oauth_verifier == null)
            {
                resp.Failed = true;
                resp.Text   = "Bad PIN code!";
                Disconnect();
                return(resp);
            }

            Twitt verify = new Twitt()
            {
                Text = oauth_verifier, Media = null
            };
            string access_url = "https://api.twitter.com/oauth/access_token";

            var response = SendPOSTRequest(verify, access_url, null, oauth_token);

            OauthMembers set = new OauthMembers(response.Text);

            // access_token_secret
            this.oauth_token        = set.oauth_token;
            this.oauth_token_secret = set.oauth_token_secret;

            if (onAuthorized != null)
            {
                onAuthorized.Invoke(oauth_token, oauth_token_secret);
            }

            var res = GetCredentials("https://api.twitter.com/1.1/account/verify_credentials.json");

            User = new User(res.Text);

            return(resp);
        }