public override ActionResult Index(RenderModel model) { var error = Request.QueryString["error"]; if (!string.IsNullOrEmpty(error)) { //User denied the facebook permission if (Convert.ToInt32(Request.QueryString["error_code"]) == 200) { //Log the FB drop outs if required return(Redirect("/")); } throw new FacebookException(Convert.ToInt32(Request.QueryString["error_code"]), Request.QueryString["error_description"]); } var fbCode = Request.QueryString["code"]; //var returnUrl = Request.QueryString["state"]; //TODO: Get the status, decrypt and check the authenticity before redirection var fbAuthToken = _authenticationRepository.GetFbToken(fbCode, _fbConfigHelper.GetAppRedirectUri()); return(Redirect(_fbConfigHelper.GetAppFbAuthHandlerUrl(fbAuthToken))); //TODO: Attach status to the URL so authenticity can be checked }
public string GetFbAuthUrl() { return(string.Format("https://www.facebook.com/dialog/oauth?client_id={0}&redirect_uri={1}&scope={2}", _configHelper.GetFbClientId(), WebUtility.UrlEncode(_configHelper.GetAppRedirectUri()), _configHelper.GetFbScopes())); }