Anu Nair Anu Nair - 16 days ago 9
Git Question

Facebook login for phonegap app

Im trying to include facebook login to my phonegap application. I have used the https://github.com/Wizcorp/phonegap-facebook-plugin.git plugin for this. Im getting the error like this when i try to test the login in my phone:

"given url is not allowed by the application configuration one or more of the given urls isnot allowed by the apps settings. to use this url you must add a valid native platform in your apps settings"

Code:

$("#fbbtn-login").click(function(){
facebookConnectPlugin.getLoginStatus(function(data){
console.log(data);
if(data.status == "connected"){
//alert('Already logged in');
apiTest();
}else{
// goto login
}
},function(e){ console.log(e);});

facebookConnectPlugin.login(["public_profile"], function(data){
console.log(data);
console.log('login success');
//alert(JSON.stringify(data));
}, function(e){
console.log(e);
});

//var facebook_email;

var apiTest = function () {
//alert("email");
facebookConnectPlugin.api( "me/?fields=id,email",
function (response) {
alert(JSON.stringify(response));
// localStorage.setItem('facebook_email', response.email);
//alert(facebook_email);
// localStorage.setItem("facebook_flag","1");
//alert(facebook_flag);
// window.location="getting-started.html";
//alert("after navigation");
},
function (response) {
//alert(JSON.stringify(response));
});
}
});

Answer

Sounds like a facebook app configuration problem. Did you set up the facebook login in the app and did you ad an android and ios platform in the facebook app?

For android you need to generate a key for example.

You can use that link to guide you through the process: https://developers.facebook.com/quickstarts/1594234934213595/?platform=android

Comments