-1

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: enter image description here

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

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
user2265231
  • 79
  • 1
  • 9

1 Answers1

3

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.

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • My app build on worklight using loginfb to get user infomation and using it for my app,but if i using fb sdk for android to login and get user infomation ,How i can used information i've get from that to my app ? – user2265231 Jul 14 '13 at 06:46
  • I don't understand the question. Please familiarize yourself with the Facebook Login SDK for Android, it contains all the API methods you require. – Idan Adar Jul 14 '13 at 06:47
  • please view this [link](http://stackoverflow.com/questions/17637355/combine-android-with-worklight) i've explain my question in that. – user2265231 Jul 14 '13 at 07:13
  • Ok. For this current question, please mark it as Answered if it has been answered for you. Thanks. – Idan Adar Jul 14 '13 at 07:16
  • 1
    @IdanAdar as I see existing Cordova plugins for Facebook sharing purposes are only available for iOS and Android, What about BlackBerry and Windows Phone ? Which solution do you suggest to implement FaceBook + Twitter sharing in the 4 plateforms? – WiPhone Oct 29 '13 at 11:34