IBM Worklight - config app facebook在真实设备上运行

问题描述:

我有一个使用Facebook登录的基于Worklight的应用程序。当我预览一切正常(我可以点击登录按钮,显示Facebook的登录对话框),但是当我在Android模拟器或设备上运行它,我得到的logcat以下错误:IBM Worklight - config app facebook在真实设备上运行

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 

这是在应用我的Facebook配置:

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)); 

这是facebook.com应用我的Facebook配置: enter image description here

我需要做什么来配置这在一个设备上运行?

+0

这有帮助吗? http://stackoverflow.com/questions/13079285/login-with-facebook-with-my-ibm-worklight-web-application –

+0

我试过这个,但它不工作。有什么办法吗? – user2265231

+0

为什么你的功能的开始注释掉了? //函数(d){ –

我相信这个错误发生在您身上,因为您使用的是Facebook JavaScript SDK。
此SDK是为当网络资源的服务器上:

  • 网站或
  • 移动Web应用

Facebook的应用程序需要一个应用程序域/网站的网址,一个网站或移动网络应用程序将具有,但Android应用程序没有域...

与Android环境的Worklight混合应用程序,同时使用网络资源,是而不是一个“移动网络应用程序”,它的一个应用程序

因此,您应该使用实现跨平台Facebook登录的Cordova plug-in(无论哪个插件可用)或使用Facebook SDK for Android

+0

我的应用程序建立在worklight上使用loginfb获取用户信息并将其用于我的应用程序,但是如果我使用fb sdk for android来登录并获取用户信息,我该如何使用我得到的信息到我的应用程序? – user2265231

+0

我不明白这个问题,请熟悉Facebook登录SDK for Android,它包含你需要的所有API方法。 –

+0

请查看这个[link](http://stackoverflow.com/questions/17637355/combine-android-with-worklight)我已经解释了我的问题。 – user2265231