Facebook login throws "Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed

Dvirski picture Dvirski · Dec 19, 2013 · Viewed 17.9k times · Source

I know this question was already asked many times, but still It seems to throw this error altough I tried several url addresses.

I'm trying to make facebook login through a asp.net mvc app like in microsoft tutorial here.

When I check it on local host it works fine (Site URL in facebook is set to: http://localhost:55797/ but when I try to check it after I upload the app to the server it gives me this error:

Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

My server's login page is: http://proj.ruppin.ac.il/igroup20/test1/Account/Login.aspx

I tried to write the following in my facebook app settings Site URL:

*http://proj.ruppin.ac.il/
*http://proj.ruppin.ac.il/igroup20/
*http://proj.ruppin.ac.il/igroup20/test1/
*http://proj.ruppin.ac.il/igroup20/test1/Account/
*http://proj.ruppin.ac.il/igroup20/test1/Account/Login.aspx

but none of them works for me.

this is my AuthConfig.cs:

public static void RegisterOpenAuth()
        {
            // See http://go.microsoft.com/fwlink/?LinkId=252803 for details on setting up this ASP.NET
            // application to support logging in via external services.

            //OpenAuth.AuthenticationClients.AddTwitter(
            //    consumerKey: "your Twitter consumer key",
            //    consumerSecret: "your Twitter consumer secret");

            OpenAuth.AuthenticationClients.AddFacebook(
                appId: "474928559284763",
                appSecret: "****"); //hidden just for this question


            //OpenAuth.AuthenticationClients.AddMicrosoft(
            //    clientId: "your Microsoft account client id",
            //    clientSecret: "your Microsoft account client secret");

            //OpenAuth.AuthenticationClients.AddGoogle();
        }

EDIT:

those are the screens that seems relevant to me, but I seem to have different gui, not like Tommy for example down here in this post:

Screen1

Screen2

EDIT2:

I just noticed there is a place for app domains and wrote there "proj.ruppin.ac.il" and in the web site url: "http://proj.ruppin.ac.il/igroup20/test1/" but still same error

Answer

HockeyJ picture HockeyJ · May 7, 2014

For the benefit of searchers, I had the same when creating a test version of a site.

The answer was to go into the facebook site > Apps > My App > Settings > 'Advanced' tab and add the localhost address in the section titled 'Valid OAuth redirect URIs'.

Note: The same style of work will be required for an xyz.azurewebsites.net domain as well as a .com when you are testing.