Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
966 views
in Technique[技术] by (71.8m points)

facebook javascript sdk - Given URL is not permitted by the application configuration

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

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...