简体   繁体   中英

Facebook api return error code 100

I got this error every time i was trying to call Send dialog via Facebook JS Sdk.

API Error Code: 100 API Error Description: Invalid parameter Error Message: 'link' is invalid.

Here is my code.

Init

     window.fbAsyncInit = function() {
            // init the FB JS SDK
            FB.init({
                appId      : '${sp.apiKey}', // App ID from the App Dashboard
                //       channelUrl : 'http://localhost:8084/facebook/callback', // Channel File for x-domain communication
                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

        };
        (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*/ true));

Send dialog function

 function sendFacebookMessage(id, jobid){

            FB.ui({
                method: 'send',
                name: 'Some text here.',
                to:id,
                link: 'www.some-url.com'

               //tomcat is running on port 8084
            });
        }  

I've tried with http:// ...without it...

every time the result is same .. 'link' is invalid.

Any ideas?

The documentation isn't specific on it, but you likely can't specify a localhost link in this context. That URL is valid only for you on your local machine. It's not suitable as a link on a public web site.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM