bisrael / cordova-plugin-facebook

Cordova Plugin for iOS and Android Facebook SDK
MIT License
25 stars 21 forks source link

cordova-plugin-facebook / login #18

Open canado opened 7 years ago

canado commented 7 years ago

Hello,

I am using the cordova-plugin-facebook and I have difficulties to login. First here is my plugin configuration inside config.xml

then in my code I have CordovaFacebook.login({ permissions: ['email'], onSuccess: function(result) { if(result.declined.length > 0) { alert("The User declined something!"); }else { alert("good login"); } }, onFailure: function(result) { if(result.cancelled) { } else if(result.error) { alert("There was an error:" + result.errorLocalized); } } }); I made a button to login, and once I tap on it, it opens a new webview with this facebook message > Given URL is not allowed by the Application configuration: One or more of the given URLs is not allowed by the App's settings. To use this URL you must add a valid native platform in your App's settings. As I understand the error message is asking me to add a valid native platform such as android or iOS, but I am using the cordova-plugin, to avoid using a native platform ! Am I missing something ? What facebook app configuration do I need to follow in order to use the login feature ? Thanks ![device-2016-11-06-100902](https://cloud.githubusercontent.com/assets/845879/20038925/a7db861a-a409-11e6-9fe1-0b133002ca81.png)
aureliocurado commented 7 years ago

You have to create add the platform in facebook for Android and IOS. Go to https://developers.facebook.com/. First create an application, after go to configuration, basic, add platform, add IOS and set the ID, add Android and create hash, after that, everythings works

AislingOR commented 7 years ago

Hi @aureliocurado I'm having a similar issue with my Cordova app, I'm receiving a message saying "You are not logged in: You are not logged in. Please log in and try again." I think this might be caused by me testing on an Android phone while not having the Android platform set up (even though it's a Cordova app).

I went to my Facebook developer page and I'm trying to add Android as a platform, but it's asking for things I don't have (such as "Package Name" and "Default Activity Class Name") I don't have these things as I'm not developing a Native Android app.

What do you recommend I do in this instance? Thanks for your help.

aureliocurado commented 7 years ago

It,s easy to do the profile on Android, but on IOS you have to do the DUNS number before to create your developer profile.