public AuthModule(ITwitter twitter) : base("/auth") { Get["/twitter"] = _ => { string callback = TwitterCallback; if (Request.Query.returnUrl != null) { callback += "?returnUrl=" + ((string)Request.Query.returnUrl).UrlEncode(); } return(new RedirectResponse(twitter.GetAuthorizeUri(ConsumerKey, ConsumerSecret, new Uri(callback)).ToString())); }; Get["/twitter_callback"] = _ => this.LoginAndRedirect((Guid)twitter.GetUser(ConsumerKey, ConsumerSecret, Request.Query.oauth_token, Request.Query.oauth_verifier). UserGuid, DateTime.Today.AddDays(1), Request.Query.returnUrl as string ?? "/"); }
public AuthModule(ITwitter twitter) : base("/auth") { Get["/twitter"] = _ => { string callback = TwitterCallback; if (Request.Query.returnUrl != null) { callback += "?returnUrl=" + ((string) Request.Query.returnUrl).UrlEncode(); } return new RedirectResponse(twitter.GetAuthorizeUri(ConsumerKey, ConsumerSecret, new Uri(callback)).ToString()); }; Get["/twitter_callback"] = _ => this.LoginAndRedirect((Guid) twitter.GetUser(ConsumerKey, ConsumerSecret, Request.Query.oauth_token, Request.Query.oauth_verifier). UserGuid, DateTime.Today.AddDays(1), Request.Query.returnUrl as string ?? "/"); }