且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

IBM Worklight - 将应用程序的Facebook配置为在实际设备中运行

更新时间:2022-12-22 10:48:17

我相信这个错误发生在你身上,因为你使用的是Facebook的JavaScript SDK。 $ b此SDK适用于网络资源位于服务器上的时间:




  • 网站或

  • 移动网络应用程序



Facebook应用程序需要站点或移动网络应用程序拥有的App Domain / Site URL,但是Android应用程序没有域...



使用Android环境的Worklight混合应用程序使用网络资源时, 移动网络应用,它是应用



因此,您应该使用 Cordova插件,实现跨平台的Facebook登录(以可用的方式插件),或使用 Android SDK SDK SDK


I have a Worklight-based app that uses Facebook Login. When I preview it everything is ok (I can click the login button and the Facebook Login dialog box is displayed), but when I run it on the Android Emulator or device I get the following error in LogCat:

05-28 09:17:35.391: I / Web Console (751): URL has not been configured
> to allow application.: One or more of the provided URL is not set app
> permissions. URL must match the URL of the web page or the page URL or
> domain is a subdomain of the domain of application. at
> https://www.facebook.com/connect/ping?client_id=321009794697186&response_type=token%2Csigned_request%2Ccode&domain=&origin=2&redirect_uri=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D24%23cb%3Df1eae8b44c%26origin%3Dfile%253A%252F%252F%252Ff3688c0c94%26domain%3D%26relation%3Dparent&sdk=joey:1

This is my Facebook configuration in the app:

window.fbAsyncInit = function() {   FB.init({
    appId      : 'xxxxx', // App ID   //  channelUrl : 'http://stormy-sands-2143.herokuapp.com/channel.html', // Channel File
    status     : true, // check login status
    cookie     : true, // enable cookies to allow the server to access the session
    xfbml      : true,  // parse XFBML
    oauth: true   });


  };

  // Load the SDK asynchronously    (function(d){
     var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "http://connect.facebook.net/en_US/all.js";
     d.getElementsByTagName('head')[0].appendChild(js);    }(document));

This is my Facebook configuration in the facebook.com app:

What do I need to configure for this to run in a device?

I believe this error happens to you because you are using the Facebook JavaScript SDK.
This SDK is meant for when the web resources are on a server:

  • web sites or
  • mobile web apps

The Facebook App requires an App Domain/Site URL that a site or mobile web app would have, but an Android app doesn't have a domain...

A Worklight Hybrid app with the Android environment, while using web resources, is not a "mobile web app", it's an app.

Thus, you should either use a Cordova plug-in that implements Facebook login across platforms (whichever is available by the plug-in), or use the Facebook SDK for Android.