Given URL is not allowed by the Application config

2019-01-06 13:12发布

问题:

I am trying to create facebook sign-in page according to this tutorial. I only changed the two lines

appId      : '370675846382420', // App ID
channelUrl : '//http://bp.php5.cz/channel.html', // Channel File

and I get the following 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.

What might be the problem?

回答1:

The problem is that whatever url you are currently hosting your app is not setup in your Application configuration. Go to your app settings and ensure the urls are matching.

Updated

Steps:

  1. Go to 'Basic' settings for your app
  2. Select 'Add Platform'
  3. Select 'Website'
  4. Put your website URL under 'Site URL'



回答2:

This can also happen when the redirect_uri submitted with the https://www.facebook.com/dialog/oauth request is not present in the list of Valid OAuth redirect URIs under:

  • Settings >> Advanced >> Security

After much trial and error, when I added the redirect_uri that I was using (https://www.facebook.com/connect/login_success.html in my case), I suddenly got to the step past this error.



回答3:

The above answers are right, but you have to make sure you input right URL.

You have to go to: https://developers.facebook.com/apps

  1. Select your app
  2. Click settings
  3. Enter contact email (for publishing)
  4. Click on +add platform
  5. Add your platform (probably WEB)
  6. Enter site URL

You have two choices to enter: http://www.example.com or http://example.com

Your app will work only with one of them. In order to make sure your visitors will use your desired url, use .htaccess on your domain.

Here's good tutorial on that: http://eppand.com/redirect-www-to-non-www-with-htaccess-file/

Enjoy!



回答4:

Go to your application, settings (basic tab) and add platform (website). Type your site url and done.



回答5:

Do the above work of adding the site and then the url. I think the layout of facebook has changed little bit so also do the below things. - Go to developers.facebook.com -> your app - Go to Settings->Advanced. - Under the Security->Valid OAuth redirect URIs, insert all the uri's your app is supposed to redirect to. For example ( http://localhost:1443/cas/login, https://localhost:2443/cas/login, http://rajanpupa.com/cas/login etc) - That should do it.



回答6:

I faced the same issue. I had entered http://www.example.com in the App settings. When anybody accessed my website using the full URL, Facebook Login worked fine. But if somebody typed in the URL without www in the browser, Facebook Login failed with this error message. When I changed the App Setting to http://example.com everything started working fine.



回答7:

The other answers here are excellent and accurate. In the interest of adding to the list of things to try:

Double and triple-check that your app is using the right application ID and secret key. In my case, after trying many other things, I checked the application ID and secret key and found that I was using our production settings on our development system. Doh!

Using the correct application ID and secret key fixed the problem.



回答8:

My Problem Solved by

public static final String REDIRECT_URI = "http://google.com"; 

it will redirect to Url after ur Login into Facebook.and also you have to reach

url : https://developers.facebook.com -> My App -> (Select your app) ->Settings ->Advanced Setting -> Valid OAuth redirect URIs : "http://google.com".

In the place of "http://google.com" you can place ur respective project Url.so,that it will redirect to your Page.



回答9:

I was getting this error when trying to run my test web page directly from "file:///C:/webtests/myfile.htm". To fix it, I didn't have to make any changes to my App Settings. Instead, I just had to host my HTML file on an actual server and then hit it like: "http://localhost/myfile.htm".

Hope that helps someone.



回答10:

I'm using the Facebook Canvas platform (Unity WebGL) and I don't needed to add the Website platform. The only thing I did was add my website root url in:

  • Product
    • Facebook Login
      • Valid OAuth redirect URIs



回答11:

Go to https://developers.facebook.com/apps and open the app you have created. open setting tab and add platform and insert site url where you want to share facebook button .Its done.



回答12:

For me it was the "Single Sign On" (can be seen at the bottome of the screenshot in phwd's answer) setting that was turned off.



回答13:

I ran into this with the IBM BlueMix SSO service and had to use the BlueMix provided redirect URL as my "site" URL instead of my actually web application site URL to fix it. Once I made that change the problem went away.



回答14:

This can be caused by incorrect app-ID

In my ionic sample I had the same issue because I had inserted a different "app-ID" in my ionic app other than the app-ID I received from Facebook developer account.

so we have to carefully insert the relavent appID



回答15:

Things have evolved in Facebooks approach, I now realised that you need to "Add Product" to your App: facebook login. make sure oauth & web auth on add my own site url to ""Valid Auth redirect URI" (and removed the default https://www.facebook.com/connect/login_success.html which his in the

Without this I get the URL Blocked error.