I have used this in my html page...
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'xxxxxxxxxxxxxx', // App ID from the App Dashboard
status : true, // check the login status upon init?
cookie : true, // set sessions cookies to allow your server to access the session?
xfbml : true // parse XFBML tags on this page?
});
// Additional initialization code such as adding Event Listeners goes here
};
// Load the SDK's source Asynchronously
// Note that the debug version is being actively developed and might
// contain some type checks that are overly strict.
// Please report such bugs using the bugs tool.
(function(d, debug){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js";
ref.parentNode.insertBefore(js, ref);
}(document, /*debug*/ false));
function shareOnFb(action, msg){
FB.ui({
method: action,
message: msg
});
}
</script>
when every I try to call any FB method it says this in my console
Given URL is not permitted 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 Apps domains.
this is my fb app setting.. do i need to change something here, m running my website locally for time being, so i tried adding
localhost/OfferDrive/ to app domain on this page but it says error that it is not a valid domain
fb app settings
-
1possible duplicate of how can i use localhost while developing facebook graph website?Alexei Levenkov– Alexei Levenkov2013年01月23日 07:04:05 +00:00Commented Jan 23, 2013 at 7:04
-
1@AlexeiLevenkov thnx, but i didnt even knew m using graph API :P thnx for letting me know.. i can search my queries better now :D1Mayur– 1Mayur2013年01月23日 07:10:22 +00:00Commented Jan 23, 2013 at 7:10
-
I am getting message - URLs is not permitted 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.Bhavik Ambani– Bhavik Ambani2015年11月20日 11:50:19 +00:00Commented Nov 20, 2015 at 11:50
10 Answers 10
You need to fill the value for Website with Facebook Login with the value http://localhost/OfferDrive/
to allow Facebook to authenticate that the requests from JavaScript SDK are coming from right place
-
I guess it did the trick, at least m getting some syntax error now ;) will solve that and let you know1Mayur– 1Mayur2013年01月23日 07:18:36 +00:00Commented Jan 23, 2013 at 7:18
-
Do post if you get any other troubleAnvesh Saxena– Anvesh Saxena2013年01月23日 11:29:49 +00:00Commented Jan 23, 2013 at 11:29
-
how to post images while publishing to wall.. i get an error "FBCDN image is not allowed in stream"1Mayur– 1Mayur2013年01月23日 13:41:25 +00:00Commented Jan 23, 2013 at 13:41
-
1same here: Top-level domains are not allowedAndrade– Andrade2014年03月29日 23:03:17 +00:00Commented Mar 29, 2014 at 23:03
-
1I received the top level domain error as well. Creating a separate Facebook app for development purposes and setting its "Site URL" (not "App Domains") after clicking "Add Platform" --> "Website" worked for me.Taylor D. Edmiston– Taylor D. Edmiston2014年04月29日 14:52:27 +00:00Commented Apr 29, 2014 at 14:52
Update to Anvesh Saxena's answer(correct but outdated as FB App interface has changed):
In your FB App configuration you need to add a Website platform with your website's URL set. Then you can add App Domains which I set to our website's base domain (e.g. for a URL like http://www.mycoolwebsite.com
, just use mycoolwebsite.com
).
New FB Settings Screenshot
IMPORTANT: In order for this to work you'll need to be using a subdomain of your app's URL for your local development. You can do this easily by modifying your hosts file on your development computer to use a non-existent subdomain of your website such as local.mycoolwebsite.com
. Just google 'edit hosts file' for your platform (e.g. mac / windows) if you're not familiar with how to do this.
-
Another possible solution, as mentioned by Heroku, is to create a separate Facebook app for development (see devcenter.heroku.com/articles/…). Note that using 127.0.0.1:5000 as shown returned on error on Facebook for me, but localhost:5000 worked fine.Taylor D. Edmiston– Taylor D. Edmiston2014年04月29日 14:48:48 +00:00Commented Apr 29, 2014 at 14:48
-
I am getting message - URLs is not permitted 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.Bhavik Ambani– Bhavik Ambani2015年11月20日 11:49:57 +00:00Commented Nov 20, 2015 at 11:49
-
I had all of these, but was incorrectly using
...heroku.com
instead of...herokuapp.com
. When I fixed these and updated everything to usehttps://
, it started working great.Seth– Seth2015年11月27日 17:50:24 +00:00Commented Nov 27, 2015 at 17:50
Settings -> Advanced, add url to "Valid OAuth redirect URIs". This works for me.
-
3Thanks! Worked for me, I added both localhost & localhost:8100 (doing Ionic development)George Kagan– George Kagan2015年04月04日 12:03:12 +00:00Commented Apr 4, 2015 at 12:03
-
Thank you!! I tried all kinds of combinations on the "Basic" page and didn't even notice the OAuth field on "Advanced".Madeline Trotter– Madeline Trotter2015年05月13日 21:08:14 +00:00Commented May 13, 2015 at 21:08
-
We changed domains for our app, moving it to a subdomain. This was required even though the subdomain was authorized.tvanfosson– tvanfosson2015年08月18日 14:38:37 +00:00Commented Aug 18, 2015 at 14:38
-
1Thanks a lot. I added localhost:3000 (Node.JS) and it works! Thanks againEnrico Giurin– Enrico Giurin2015年10月13日 01:23:16 +00:00Commented Oct 13, 2015 at 1:23
- Go to Facebook for developers dashboard
- Click
My Apps
and select your App from the dropdown.
(If you haven't already created any app select "Add a New App" to create a new app). - Go to
App Setting > Basic Tab
and then click "Add Platform" at bottom section. - Select "Website" and the add the website to log in as the
Site URL
(e.g.mywebsite.com
) - If you are testing in local, you can even just give the localhost URL of your app.
eg.http://localhost:8080/myfbsampleapp
- Save changes and you can now access Facebook information from
http://localhost:8080/myfbsampleapp
-
Getting message - URLs is not permitted 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.Bhavik Ambani– Bhavik Ambani2015年11月20日 11:49:44 +00:00Commented Nov 20, 2015 at 11:49
-
@BhavikAmbani Did you try my answer?Lucky– Lucky2015年11月20日 12:09:29 +00:00Commented Nov 20, 2015 at 12:09
-
@Lucky yes, still facing same probBhavik Ambani– Bhavik Ambani2015年11月20日 12:10:27 +00:00Commented Nov 20, 2015 at 12:10
-
@BhavikAmbani At which step are you getting the message? Please verify the Website URL properly that you entered in the page..Lucky– Lucky2015年11月20日 12:10:43 +00:00Commented Nov 20, 2015 at 12:10
-
@Lucky I have verified the same and also getting the same message.Bhavik Ambani– Bhavik Ambani2015年11月20日 12:32:41 +00:00Commented Nov 20, 2015 at 12:32
An update to munsellj's update..
I got this working in development just by adding localhost:3000 to the 'Website URL' option and leaving the App Domains box blank. As munsellj mentioned, make sure you've added a website platform.
- From the menu item of your app name which is located on the top left corner, create a test app.
- In the settings section of the new test app: add 'http://localhost:3000' to the Website url and add 'localhost' to App domains.
- Update your app with the new Facebook APP Id
- Use Facebook sdk v2.2 or whatever the latest in your app.
Note, the localhost is a special string that FB allows here. If you didn't configure your debugging environment under localhost, you'll have to push it underneath that name as far as I can tell.
Sometimes this error occurs for old javascript sdk. If you save locally javascript file. Update it. I prefer to load it form the facebook server all the time.
-
I followed all the suggestions above and none worked, it wasn't until I pointed my app directly at the Facebook CDN that it finally worked (was using an older version locally)Neil– Neil2014年02月23日 00:49:31 +00:00Commented Feb 23, 2014 at 0:49
Missing from the other answers is how to allow localhost(or 0.0.0.0 or whatever) as an oauth callback url. Here is the explanation. How can I add localhost:3000 to Facebook App for development
Another reason this can happen is if you send the wrong appId. This can happen in early development if you have a development app and a production app. If you hard-code the appId for dev and push to prod, this will show up.
-
Fixed my problem! Forgot to change the appid and was starting to get worried.Henry– Henry2014年09月01日 16:40:38 +00:00Commented Sep 1, 2014 at 16:40
Explore related questions
See similar questions with these tags.