Example #1
0
        public string GetTweets()
        {
            // Uppgift 6:
            var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, this.TokenManager);
            XPathDocument updates = new XPathDocument(TwitterConsumer.GetUpdates(twitter, this.AccessToken).CreateReader());
            XPathNavigator nav = updates.CreateNavigator();
            var parsedUpdates = from status in nav.Select("/statuses/status").OfType<XPathNavigator>()
                                where !status.SelectSingleNode("user/protected").ValueAsBoolean
                                select new
                                {
                                    User = status.SelectSingleNode("user/name").InnerXml,
                                    Status = status.SelectSingleNode("text").InnerXml,
                                };

            StringBuilder tableBuilder = new StringBuilder();
            tableBuilder.Append("<table><tr><td>Name</td><td>Update</td></tr>");

            foreach (var update in parsedUpdates)
            {
                tableBuilder.AppendFormat(
                    "<tr><td>{0}</td><td>{1}</td></tr>",
                    HttpUtility.HtmlEncode(update.User),
                    HttpUtility.HtmlEncode(update.Status));
            }
            tableBuilder.Append("</table>");
            return tableBuilder.ToString();
        }
 public TwitterService(IRepository repository, IAuthenticationService authenticationService)
 {
     _twitter = new WebConsumer(TwitterConsumer.ServiceDescription, TokenManager);
     _shorteningService = new TwitterLib.UrlShorteningService(ShorteningService.Bitly);
     _repository = repository;
     _authenticationService = authenticationService;
 }
		protected void Page_Load(object sender, EventArgs e) {
			var google = new WebConsumer(GoogleConsumer.ServiceDescription, this.TokenManager);
			string accessToken = google.RequestNewClientAccount();
			////string tokenSecret = google.TokenManager.GetTokenSecret(accessToken);
			MessageReceivingEndpoint ep = null; // set up your authorized call here.
			google.PrepareAuthorizedRequestAndSend(ep, accessToken);
		}
 public Investigator()
 {
     logger = LogManager.GetLogger(typeof(Investigator));
     InMemoryTokenManager tokenManager = new InMemoryTokenManager(Constants.TwitterConsumerKey, Constants.TwitterConsumerSecret);
     tokenManager.StoreAccessToken(Constants.TwitterAccessToken, Constants.TwitterAccessSecret);
     consumer = new WebConsumer(UserModule.ServiceDescription, tokenManager);
 }
Example #5
0
        static void Main(string[] args)
        {
            var providerDesc = new ServiceProviderDescription()
            {
                RequestTokenEndpoint      = new MessageReceivingEndpoint("http://localhost:8008/noop", HttpDeliveryMethods.PostRequest),
                AccessTokenEndpoint       = new MessageReceivingEndpoint("http://localhost:8008/noop", HttpDeliveryMethods.PostRequest),
                UserAuthorizationEndpoint = new MessageReceivingEndpoint("http://localhost:8008/noop", HttpDeliveryMethods.PostRequest),
                ProtocolVersion           = ProtocolVersion.V10a,
                TamperProtectionElements  = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() }
            };

            var consumerKey    = "dotnet-test-key";
            var consumerSecret = File.ReadAllText("..\\..\\keys\\8008\\8080\\" + consumerKey);

            var zeroLeggedWebConsumer = new DotNetOpenAuth.OAuth.WebConsumer(providerDesc, new ZeroLeggedTokenManager(consumerKey, consumerSecret));

            var endpoint    = new MessageReceivingEndpoint("http://localhost:8008/job?query=parameters&also=good", HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.PostRequest);
            var httpRequest = zeroLeggedWebConsumer.PrepareAuthorizedRequest(endpoint, "DUMMY", new Dictionary <String, String>()
            {
                { "are", "post" },
                { "parameters", "handled" },
            });

            var response        = httpRequest.GetResponse();
            var responseContent = new System.IO.StreamReader(response.GetResponseStream()).ReadToEnd();

            Console.Out.WriteLine(responseContent);
        }
        public Newtonsoft.Json.Linq.JArray Tweets()
        {
            var    cache  = System.Web.HttpContext.Current.Cache;
            JArray tweets = (JArray)cache["Tweets"];

            if (tweets == null)
            {
                var token = Get().ApplicationAuthorizationKey;
                try
                {
                    var consumer = new DotNetOpenAuth.OAuth.WebConsumer(ServiceProviderDescription(),
                                                                        new LongTermTokenProvider());

                    var endpoint = new MessageReceivingEndpoint("https://api.twitter.com/1.1/statuses/home_timeline.json",
                                                                HttpDeliveryMethods.GetRequest);

                    var request = consumer.PrepareAuthorizedRequest(endpoint, token);

                    var response = request.GetResponse();
                    var data     = (new StreamReader(response.GetResponseStream())).ReadToEnd();

                    tweets = JArray.Parse(data);
                    cache.Insert("Tweets", tweets, null, DateTime.Now.AddMinutes(5), TimeSpan.Zero);
                }
                catch (Exception ex)
                {
                    tweets = new JArray();
                }
            }

            return(tweets);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //Аутентифицируемся при загрузке странички
                if (!IsPostBack)
                {
                    var yahoo = new WebConsumer(YahooConsumer.ServiceDescription, this.TokenManager);

                    // Is Google calling back with authorization?
                    var accessTokenResponse = yahoo.ProcessUserAuthorization();
                    if (accessTokenResponse != null)
                    {
                        AccessToken = accessTokenResponse.AccessToken;
                        YahooGuid = accessTokenResponse.ExtraData["xoauth_yahoo_guid"];
                        //Redirecting to result page
                        Response.Redirect("YahooAddressBook.aspx");
                    }
                    // If we don't yet have access, immediately request it.
                    YahooConsumer.RequestAuthorization(yahoo);
                }
            }
            catch (System.Threading.ThreadAbortException)
            {

            }
            catch (Exception ex)
            {
                SubmitError(ex.Message);
            }
        }
        protected void getAddressBookButton_Click(object sender, EventArgs e)
        {
            var google = new WebConsumer(GoogleConsumer.ServiceDescription, TokenManager);

            XDocument contactsDocument = GoogleConsumer.GetContacts(google, AccessToken, 5, 1);
            var contacts = from entry in contactsDocument.Root.Elements(XName.Get("entry", "http://www.w3.org/2005/Atom"))
                           select new
                               {
                                   Name = entry.Element(XName.Get("title", "http://www.w3.org/2005/Atom")).Value, 
                                   Email = entry.Element(XName.Get("email", "http://schemas.google.com/g/2005")).Attribute("address").Value
                               };
            
            var tableBuilder = new StringBuilder();
            tableBuilder.Append("<table><tr><td>Name</td><td>Email</td></tr>");
            foreach (var contact in contacts)
            {
                tableBuilder.AppendFormat(
                    "<tr><td>{0}</td><td>{1}</td></tr>",
                    HttpUtility.HtmlEncode(contact.Name),
                    HttpUtility.HtmlEncode(contact.Email));
            }

            tableBuilder.Append("</table>");
            resultsPlaceholder.Controls.Add(new Literal { Text = tableBuilder.ToString() });
        }
        protected void downloadUpdates_Click(object sender, EventArgs e)
        {
            var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, TokenManager);
            var updates = new XPathDocument(TwitterConsumer.GetUpdates(twitter, AccessToken).CreateReader());
            XPathNavigator nav = updates.CreateNavigator();
            var parsedUpdates = from status in nav.Select("/statuses/status").OfType<XPathNavigator>()
                                where !status.SelectSingleNode("user/protected").ValueAsBoolean
                                select new
                                    {
                                        User = status.SelectSingleNode("user/name").InnerXml,
                                        Status = status.SelectSingleNode("text").InnerXml,
                                    };

            var tableBuilder = new StringBuilder();
            tableBuilder.Append("<table><tr><td>Name</td><td>Update</td></tr>");

            foreach (var update in parsedUpdates)
            {
                tableBuilder.AppendFormat(
                    "<tr><td>{0}</td><td>{1}</td></tr>",
                    HttpUtility.HtmlEncode(update.User),
                    HttpUtility.HtmlEncode(update.Status));
            }

            tableBuilder.Append("</table>");
            resultsPlaceholder.Controls.Add(new Literal { Text = tableBuilder.ToString() });
        }
 public void RequestAuthorization()
 {
     _twitter = new WebConsumer(TwitterConsumer.ServiceDescription, TokenManager);
     var accessTokenResponse = _twitter.ProcessUserAuthorization();
     if (accessTokenResponse != null)
         AccessToken = accessTokenResponse.AccessToken;
     else
         _twitter.Channel.Send(_twitter.PrepareRequestUserAuthorization());
 }
Example #11
0
        public ActionResult OAuth(string returnUrl)
        {
            var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, _consumerTokenManager);
            var url = Request.Url.ToString().Replace("OAuth", "OAuthCallback");
            var callbackUri = new Uri(url);
            twitter.Channel.Send(twitter.PrepareRequestUserAuthorization(callbackUri, null, null));

            return RedirectToAction("LogOn");
        }
Example #12
0
		/// <summary>
		/// Requests authorization from Google to access data from a set of Google applications.
		/// </summary>
		/// <param name="consumer">The Google consumer previously constructed using <see cref="CreateWebConsumer"/> or <see cref="CreateDesktopConsumer"/>.</param>
		/// <param name="requestedAccessScope">The requested access scope.</param>
		public static void RequestAuthorization(WebConsumer consumer) {
			if (consumer == null) {
				throw new ArgumentNullException("consumer");
			}

			Uri callback = Util.GetCallbackUrlFromContext();
			var request = consumer.PrepareRequestUserAuthorization(callback, null, null);
			consumer.Channel.Send(request);
		}
        protected void identifierBox_LoggingIn(object sender, OpenIdEventArgs e)
        {
            ServiceProviderDescription serviceDescription = new ServiceProviderDescription {
                TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },
            };

            WebConsumer consumer = new WebConsumer(serviceDescription, Global.OwnSampleOPHybridTokenManager);
            consumer.AttachAuthorizationRequest(e.Request, "http://tempuri.org/IDataApi/GetName");
        }
        public TwitterProxy(IConsumerTokenManager manager, ISignInEndpointBuilder endpointBuilder,
            IFubuRequest request, ISystemUrls urls)
        {
            _request = request;
            _urls = urls;

            var endpoints = endpointBuilder.Build();
            _consumer = new WebConsumer(endpoints, manager);
        }
 //http://api.linkedin.com/v1/people/~
 public static void RequestAuthorization(WebConsumer consumer)
 {
     if (consumer == null)
     {
         throw new ArgumentNullException("consumer");
     }
     Uri callback = HttpRequestExtensions.GetUrlRewriter(HttpContext.Current.Request.Headers, Util.GetCallbackUrlFromContext().StripQueryArgumentsWithPrefix("oauth_"));
     var request = consumer.PrepareRequestUserAuthorization(callback, null, null);
     consumer.Channel.Send(request);
 }
Example #16
0
 public void StartAuthentication()
 {
     var request = HttpContext.Current.Request;
     using (var twitter = new WebConsumer(ServiceDescription, _tokenManager))
     {
         var callBackUrl = new Uri(request.Url.Scheme + "://" + request.Url.Authority + CallBackUrl);
         twitter.Channel.Send(
             twitter.PrepareRequestUserAuthorization(callBackUrl, null, null)
         );
     }
 }
 protected OAuthAuthenticator(
     ServiceProviderDescription description,
     Func<string, AuthResult.Data> selector,
     string endpoint,
     string consumerKey,
     string consumerSecret)
 {
     _endpoint = new MessageReceivingEndpoint(endpoint, HttpDeliveryMethods.GetRequest);
     _selector = selector;
     _client = new WebConsumer(description, new InMemoryTokenManager(consumerKey, consumerSecret));
 }
Example #18
0
        public ActionResult OAuthCallback()
        {
            var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, _consumerTokenManager);
            var accessTokenResponse = twitter.ProcessUserAuthorization();

            if (accessTokenResponse != null)
            {
                string userName = accessTokenResponse.ExtraData["screen_name"];
                return CreateUser(userName, null, null, null);
            }

            return RedirectToAction("LogOn");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.TokenManager != null)
            {
                this.MultiView1.ActiveViewIndex = 1;

                if (!IsPostBack)
                {
                    var xing = new WebConsumer(XingClient.ServiceDescription, this.TokenManager);

                    // Is Google calling back with authorization?
                    var accessTokenResponse = xing.ProcessUserAuthorization();
                    if (accessTokenResponse != null)
                    {
                        this.AccessToken = accessTokenResponse.AccessToken;
                        //Response.Redirect("/C1_netTestPage.aspx#/Home");
                        dynamic result = XingClient.GetMe(xing, this.AccessToken);
                        string display_name = result.display_name;
                        string id = result.id;
                        string first_name = result.first_name;
                        string last_name = result.last_name;
                        string picurl = result.photo_urls.maxi_thumb;
                        dynamic result2 = XingClient.GetMyContacts(xing, this.AccessToken, "display_name", 50, 0);
                        dynamic a = result2.contacts;
                        int b = a.total;
                        dynamic c = a.users;
                        int d = c.Count;

                        string display_name1 = c[0].display_name;
                        string id1 = c[0].id;

                        dynamic result3 = XingClient.GetUser(xing, this.AccessToken, id1, "photo_urls.medium_thumb");
                        string urli = result3.photo_urls.medium_thumb;
                        dynamic result4 = XingClient.GetUser(xing, this.AccessToken, id1, "active_email");
                        string mail = result3.active_email;
                        dynamic result5 = XingClient.GetUser(xing, this.AccessToken, c[12].id);
                        string url = XingClient.GetScopeUri(XingClient.Applications.me);
                        bool result6 = XingClient.PostStatus(xing, this.AccessToken, "Hura fertig!!! ", id);

                        //Response.Redirect("/#/Home");

                    }
                    else if (this.AccessToken == null)
                    {
                        // If we don't yet have access, immediately request it.
                        XingClient.RequestAuthorization(xing, XingClient.Applications.Contacts);
                    }
                }
            }
        }
Example #20
0
        public ActionResult Login()
        {
            var oauthConsumer = new WebConsumer(Configuration.GetOauthConfiguration(), new JsonTokenManager(Request));
            var oauthResponse = oauthConsumer.ProcessUserAuthorization();

            if (oauthResponse != null)
            {
                FormsAuthentication.SetAuthCookie(oauthResponse.AccessToken, true);
                return RedirectToAction("Index");
            }

            var oauthRequest = oauthConsumer.PrepareRequestUserAuthorization(Request.Url, null, null);
            return oauthConsumer.Channel.PrepareResponse(oauthRequest).AsActionResult();
        }
Example #21
0
	protected void uploadProfilePhotoButton_Click(object sender, EventArgs e) {
		if (profilePhoto.PostedFile.ContentType == null) {
			photoUploadedLabel.Visible = true;
			photoUploadedLabel.Text = "Select a file first.";
			return;
		}

		var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, this.TokenManager);
		XDocument imageResult = TwitterConsumer.UpdateProfileImage(
			twitter,
			this.AccessToken,
			profilePhoto.PostedFile.InputStream,
			profilePhoto.PostedFile.ContentType);
		photoUploadedLabel.Visible = true;
	}
Example #22
0
        protected override AuthenticationResult VerifyAuthenticationCore(AuthorizedTokenResponse response)
        {
            var profileEndpoint = new MessageReceivingEndpoint("https://publicapi.avans.nl/oauth/studentnummer/?format=json", HttpDeliveryMethods.GetRequest);
            string accessToken = response.AccessToken;
            consumerKey = ConfigurationManager.AppSettings["AvansOAuthConsumerKey"];
            consumerSecret = ConfigurationManager.AppSettings["AvansOAuthConsumerSecret"];
            InMemoryOAuthTokenManager tokenManager = new InMemoryOAuthTokenManager(consumerKey, consumerSecret);
            tokenManager.ExpireRequestTokenAndStoreNewAccessToken(String.Empty, String.Empty, accessToken, (response as ITokenSecretContainingMessage).TokenSecret);
            WebConsumer webConsumer = new WebConsumer(AvansServiceDescription, tokenManager);

            HttpWebRequest request = webConsumer.PrepareAuthorizedRequest(profileEndpoint, accessToken);

            try
            {
                using (WebResponse profileResponse = request.GetResponse())
                {
                    using (Stream profileResponseStream = profileResponse.GetResponseStream())
                    {
                        using (StreamReader reader = new StreamReader(profileResponseStream))
                        {
                            string jsonText = reader.ReadToEnd();

                            var user = JsonConvert.DeserializeObject<List<OAuthUser>>(jsonText);

                            Dictionary<string, string> extraData = new Dictionary<string, string>();
                            extraData.Add("Id", user[0].Studentnummer ?? "Onbekend");
                            extraData.Add("Login", user[0].Inlognaam ?? "Onbekend");

                            DatabaseFactory.getInstance().getDAOStudent().putStudentInDatabase(Convert.ToInt32(user[0].Studentnummer), user[0].Inlognaam);

                            return new DotNetOpenAuth.AspNet.AuthenticationResult(true, ProviderName, extraData["Id"], extraData["Login"], extraData);
                        }
                    }
                }
                return new AuthenticationResult(false);
            }
            catch (WebException ex)
            {
                using (Stream s = ex.Response.GetResponseStream())
                {
                    using (StreamReader sr = new StreamReader(s))
                    {
                        string body = sr.ReadToEnd();
                        return new DotNetOpenAuth.AspNet.AuthenticationResult(new Exception(body, ex));
                    }
                }
            }
        }
Example #23
0
        public bool FinishAuthentication()
        {
            using (var twitter = new WebConsumer(ServiceDescription, _tokenManager))
            {
                var accessTokenResponse = twitter.ProcessUserAuthorization();
                if (accessTokenResponse != null)
                {
                    AccessToken = accessTokenResponse.AccessToken;
                    SecretToken = _tokenManager.GetTokenSecret(AccessToken);
                    UserName = accessTokenResponse.ExtraData["screen_name"];
                    return true;
                }
            }

            return false;
        }
        public ActionResult StartOAuth()
        {
            smugmug myMug = new smugmug();

            var serviceProvider = myMug.GetServiceDescription();
            var consumer = new WebConsumer(serviceProvider, myMug.InMemoryTokenManager);

            // Url to redirect to
            var authUrl = new Uri(Request.Url.Scheme + "://" + Request.Url.Authority + "/OAuth/OAuthCallBack/");

            // request access

            consumer.Channel.Send(consumer.PrepareRequestUserAuthorization(authUrl, null, null));

            // This will not get hit!
            return null;
        }
		protected void Page_Load(object sender, EventArgs e) {
			if (this.TokenManager != null) {
				this.MultiView1.ActiveViewIndex = 1;

				if (!IsPostBack) {
					var google = new WebConsumer(GoogleConsumer.ServiceDescription, this.TokenManager);

					// Is Google calling back with authorization?
					var accessTokenResponse = google.ProcessUserAuthorization();
					if (accessTokenResponse != null) {
						this.AccessToken = accessTokenResponse.AccessToken;
					} else if (this.AccessToken == null) {
						// If we don't yet have access, immediately request it.
						GoogleConsumer.RequestAuthorization(google, GoogleConsumer.Applications.Contacts);
					}
				}
			}
		}
Example #26
0
        public ActionResult About()
        {
            var twitter = new WebConsumer(TwitterConsumer.ServiceDescription,
                                            this.TokenManager);
            // Is Twitter calling back with authorization?
            var accessTokenResponse = twitter.ProcessUserAuthorization();
            if (accessTokenResponse != null)
            {
                this.AccessToken = accessTokenResponse.AccessToken;
            }
            else if (this.AccessToken == null)
            {
                // If we don't yet have access, immediately request it.
                twitter.Channel.Send(twitter.PrepareRequestUserAuthorization());
            }

            return View();
        }
        public ActionResult PrepareAuthRequest(Uri callback, IConsumerTokenManager tokenManager)
        {
            _webConsumer = new WebConsumer(GoogleConsumer.ServiceDescription, tokenManager);

            var accessToken = GetAccessToken();

            if (string.IsNullOrEmpty(accessToken))
            {
                var extraParameters = new Dictionary<string, string>();

                extraParameters.Add("scope", "https://www.googleapis.com/auth/userinfo.profile");
                var request = _webConsumer.PrepareRequestUserAuthorization(callback, extraParameters, null);

                return _webConsumer.Channel.PrepareResponse(request).AsActionResult();
            }

            return null;
        }
Example #28
0
		protected void Page_Load(object sender, EventArgs e) {
			if (this.TokenManager != null) {
				this.MultiView1.ActiveViewIndex = 1;

				if (!IsPostBack) {
					var twitter = new WebConsumer(TwitterConsumer.ServiceDescription, this.TokenManager);

					// Is Twitter calling back with authorization?
					var accessTokenResponse = twitter.ProcessUserAuthorization();
					if (accessTokenResponse != null) {
						this.AccessToken = accessTokenResponse.AccessToken;
					} else if (this.AccessToken == null) {
						// If we don't yet have access, immediately request it.
						twitter.Channel.Respond(twitter.PrepareRequestUserAuthorization());
					}
				}
			}
		}
        public void ProcessAuthRequest(IConsumerTokenManager tokenManager)
        {
            _webConsumer = new WebConsumer(TwitterConsumer.SignInWithTwitterServiceDescription, tokenManager);

            var response = _webConsumer.ProcessUserAuthorization();

            if (response == null)
            {
                return;
            }

            var screenName = response.ExtraData["screen_name"];
            var userId = int.Parse(response.ExtraData["user_id"]);

            UserId = userId.ToString(CultureInfo.CurrentCulture);
            UserName = screenName;
            PictureUrl = string.Format("http://api.twitter.com/1/users/profile_image/{0}.png", screenName);
        }
        public void ProcessAuthRequest(IConsumerTokenManager tokenManager)
        {
            _webConsumer = new WebConsumer(GoogleConsumer.ServiceDescription, tokenManager);

            var accessToken = GetAccessToken();

            if (string.IsNullOrEmpty(accessToken)) 
                throw new NoNullAllowedException("AccessToken should not be null");

            var request = _webConsumer.PrepareAuthorizedRequest(_getUserInfoEndpoint, accessToken);
            var response = _webConsumer.Channel.WebRequestHandler.GetResponse(request);
            var json = response.GetResponseReader().ReadToEnd();
            
            var jsonObject = JObject.Parse(json);
            UserId = jsonObject["id"].ToString();
            UserName = jsonObject["name"].ToString();
            PictureUrl = jsonObject["picture"].ToString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack && !string.IsNullOrEmpty(AccessToken))
                {
                    var google = new WebConsumer(YahooConsumer.ServiceDescription, TokenManager);
                    XDocument contactsDocument = YahooConsumer.GetContacts(google, AccessToken, YahooGuid);
                    const string xmlns = "http://social.yahooapis.com/v1/schema.rng";
                    var contacts = from entry in contactsDocument.Root.Elements(XName.Get("contact", xmlns))
                                   select
                                       new
                                       {
                                           Name = from field in entry.Elements(XName.Get("fields", xmlns))
                                                  where field.Element(XName.Get("type", xmlns)).Value == "name"
                                                  select field.Element(XName.Get("value", xmlns)).Element(XName.Get("givenName", xmlns)).Value,
                                           LastName = from field in entry.Elements(XName.Get("fields", xmlns))
                                                  where field.Element(XName.Get("type", xmlns)).Value == "name"
                                                      select field.Element(XName.Get("value", xmlns)).Element(XName.Get("familyName", xmlns)).Value,
                                           Email = from field in entry.Elements(XName.Get("fields", xmlns))
                                                   where field.Element(XName.Get("type", xmlns)).Value == "email"
                                                   select field.Element(XName.Get("value", xmlns)).Value,
                                       };
                    foreach (var contact in contacts)
                    {
                        AddContactInfo(contact.Name.FirstOrDefault(),contact.LastName.FirstOrDefault(), contact.Email);
                    }
                    SubmitContacts();
                }
                else
                {
                    Response.Redirect("YahooImport.aspx");
                }
            }
            catch (System.Threading.ThreadAbortException)
            {

            }
            catch (Exception ex)
            {
                SubmitError(ex.Message);
            }
        }
        public ActionResult PrepareAuthRequest(Uri callback, IConsumerTokenManager tokenManager)
        {
            _webConsumer = new WebConsumer(TwitterConsumer.SignInWithTwitterServiceDescription, tokenManager);

            var token = GetAccessToken();

            if (string.IsNullOrEmpty(token))
            {
                var redirectParameters = new Dictionary<string, string>();

                redirectParameters["force_login"] = "******";

                var request = _webConsumer.PrepareRequestUserAuthorization(callback, null, redirectParameters);

                return _webConsumer.Channel.PrepareResponse(request).AsActionResult();
            }

            return null;
        }