public ActionResult AuthCallback(string code) { if (code != null) { var _authInfo = authWorker.GetAuthInfo(code); if (_authInfo.Success) { var _id = new UserAuthWorker().CreateNewUserToken(_authInfo.Token); var _authTicket = new FormsAuthenticationTicket(1, _id.UserName, DateTime.Now, DateTime.Now.AddDays(15), true, _id.Id.ToString()); var encTicket = FormsAuthentication.Encrypt(_authTicket); var faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket); Response.Cookies.Add(faCookie); return RedirectToAction("Startup"); } return new ContentResult { Content = "Error while retrieving access token:" + _authInfo.ErrorMessage }; } return new ContentResult { Content = "User cancelled the auth sequence" }; }
public SqApiServiceFacade(string apiUrl, string userName) { url = apiUrl; userAuthWorker = new UserAuthWorker(userName); }
public SqApiServiceFacade(string url) { this.url = url; userAuthWorker = new UserAuthWorker(); }