Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 489
Dvirski Avatar asked Dec 19 '13 19:12

Dvirski


4 Answers

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.

like image 100
JsAndDotNet Avatar answered Oct 22 '22 01:10

JsAndDotNet


Try this! These steps worked for my fb app hosted locally on http://localhost:3000/

Once signed in to your app on developers.facebook.com/...

  1. Click Settings > Basic
  2. Leave the "App Domains" field blank.
  3. Click + Add Platform > Website
  4. Use http://localhost:3000/ for both "Site URL" and "Mobile Site URL" fields
  5. Click Save Changes

FINALLY!

like image 22
jlynchdotco Avatar answered Oct 22 '22 03:10

jlynchdotco


You will need to update your App Domains as well in the Facebook Application configuration module to proj.ruppin.ac.il (Image taken from referenced tutorial to show that there are 2 places to update when changing FB app login URL)

enter image description here

like image 3
Tommy Avatar answered Oct 22 '22 02:10

Tommy


Here's all the things I did to get this working

  1. Nothing in "App Domains"
  2. Put the server name (with port) in "Site URL"
  3. In the "App Details" tab turn on your "Website" (I have the mobile website on) http://cl.ly/image/0h0D0L050Z2v (Why is this separate from setting the URL?)
  4. Quadruple check your appid. I swear mine changed. But maybe I'm hallucinating that.
like image 1
Andy V Avatar answered Oct 22 '22 01:10

Andy V