How to login with Facebook now?

Hi,

I used to use angular-easyfb with the Facebook Cordova plugin.
But while reading this, http://noellh.com/blog/facebook-cordova-angularjs-easyfb/, it seems I’m now stuck.

What is the current way to connect with Facebook using Ionic?

Thanks a lot :slight_smile:

Michael

This seems to work really well.

http://coenraets.org/blog/2014/04/facebook-phonegap-cordova-without-plugin/

Actually what I did is:

  1. Installing this: https://github.com/Wizcorp/phonegap-facebook-plugin
    Adding manually the .m and .h files into the right plugin folder (not done automatically, sounds like a bug)
  2. Installing this: https://github.com/dunksmith/facebookConnectPlugin-angular in order to benefit from Angular encapsulation.

Works pretty well, as well for native API or Browser :slight_smile:

2 Likes

Hmm, that cool, I didn’t know about this!

Thanks for sharing that :smile:

1 Like

Yes, the benefit is that it’s not an “in-app browser” that is opening, but the real native way is used.

However, the drawback is that the manual step is mandatory, sounds like they’ll fix this.

But I read that the ng-cordova library is likely to adopt a Facebook connection widget.
That would be awesome :smiley:

1 Like

Already there

https://github.com/driftyco/ng-cordova/blob/master/src/plugins/facebookConnect.js

But there’s no docs for it yet. Up for making a PR and adding some docs for it?

1 Like

Good :slight_smile: As soon as I finish my tasks (regarding delay), I will try it.

Thanks :wink:

Nice! just noticed that the facebookConnectPlugin has been updated(or the api has) and now my facebook register function is broken, So i’m gonna check this out right now!

I see ngcordova is also planning to use the facebookConnectPlugin, I had it working once but on each build I had to do a bunch of manual commands in the cli, and whilst i had it working once, I removed and re-added the plugin and now it only works if i follow the code and remove the plugin everytime i wanna test my app,

cordova platform add android

cordova -d plugin add https://github.com/phonegap/phonegap-facebook-plugin.git --variable APP_ID="123456789" --variable APP_NAME="myApplication"

android update project --subprojects --path "platforms/android" --target android-19 --library "CordovaLib"

android update project --subprojects --path "platforms/android" --target android-19 --library "FacebookLib"

cd platforms/android/

ant clean

cd FacebookLib

ant clean

open -e AndroidManifest.xml 

// change your minSdkVersion and your targetSdkVersion to your environment settings for me it was:
// <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />

ant release

cd ../../..

cordova build android
1 Like