Facebook Login With Localhost RRS feed

  • Question

  • User-698989805 posted

    Hello friends! I am trying to implement facebook login in one of the ASP.NET application locally and installed the Facebook component/plugin from the nuget.org. I've the app id and secret but I am getting the following error:

    Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings

    I've done the following in the facebook developer dashboard adding product (Facebook Login) on the left side of the dashboard:

    Below the code I've tried but seems like I've configuration issues that I am unable to figure out with localhost:

    protected void btnLogin_Click(object sender, EventArgs e)
        var userLogin = fb.GetLoginUrl(new
            app_id = ,
            redirect_uri = "http://localhost:7308/FbLogin.aspx",
            response_type = "code"
    public void RedirectToFb()
        if (Request.QueryString["code"] != null)
            string accessCode = Request.QueryString["Code"].ToString();
            dynamic info = fb.Post("oauth/access_token", new
                app_id = ,
                app_secret = "",
                redirect_uri = "http://localhost:7308/FbLogin.aspx",
                code = accessCode
            var accessToken = info.access_token;
            var expriration = info.expires;
            Session["AccessToken"] = accessToken;
            fb.AccessToken = accessToken;
            dynamic userInfo = fb.Get("me?fields=name,email");
            string id = userInfo.id;
            string name = userInfo.name;
            string email = userInfo.email;
            lblUserDetails.Text = "User Name: " + name + " User Email: " + "(" + email + ")";
            btnLogin.Text = "Log Out";
            FormsAuthentication.SetAuthCookie(email, false);

    I would be looking forward for a quick suggestion or any useful alternative will do. Thanks.

    Sunday, October 29, 2017 11:20 AM


  • User475983607 posted

    For one, the redirect_uri, http://localhost:7308/FbLogin.aspx , in the code behind does not match the FaceBook redirect URI configuration.   

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, October 29, 2017 11:52 AM