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

隐身守侯 提交于 2019-12-09 15:08:26

问题


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:

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


回答1:


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.




回答2:


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!




回答3:


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)




回答4:


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.



回答5:


I got it to work with example.com in the settings. No http://www. It should work for you too (and you can add more that one domain.




回答6:


Your issue is with your Facebook JavaScript SDK implementation and your Facebook app settings. The JS SDK is failing to initialize because it's been given the "wrong" settings.

The App Domain should be proj.ruppin.ac.il, and the Site URL should be http://proj.ruppin.ac.il/igroup20/test1/. It appears you've already done that. If so, make sure it saved properly, and you're not receiving any validation issues.

Lastly, go to your Facebook App's "Dashboard" and look for any warnings. For example, you may see Sandbox Mode is enabled; you may need to disable it before you can use the Facebook JS SDK.

Like others, I'm still seeing the "old" Facebook apps panel, but if you could provide a full screen capture of the "Dashboard" and "Settings" panes, we could be more helpful.




回答7:


For the errors like top level domains are not allowed we need to provide both website and mobile url along with port number this works for me fine




回答8:


you just need to also include the port number for your local host.




回答9:


you can give the url like this:

1. https://developers.facebook.com/x/apps/662194763843967/settings/

Add your dome at App Domains in app settings see don't use http://

suppose your domain is

http://localhost/abhinav/

then write localhost/abhinav/

  1. click on add platform let say its a web app

write your full site url at website text-box

Site URL : http://localhost/abhinav/

Below is the reference image where you can see what should you place at App Domains

http://i.stack.imgur.com/qZVkk.png\




回答10:


So,there is some bug in Facebook and its APIs-

There is currently a bug which will prevent Facebook Login for Windows Phone from working if you have any entries in the "Valid OAuth redirect URIs" field in the Advanced section of your app settings. This can be worked around by adding "https://m.facebook.com/dialog/return/ms" in this field.

Try different links this one worked for me

"http://www.facebook.com/"



来源:https://stackoverflow.com/questions/20690174/facebook-login-throws-given-url-is-not-allowed-by-the-application-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!