cordova plugin facebook
cordova plugin facebook
cordova plugin facebook

Cordova plugin facebook allows the developers to enable social login for their applications. this plugin is used of authentication purpose and we can also get user’s information such as public profile, birthday, friends list and much more.

We also have few advantages with these social login, such as increased conversion rate, easy to authenticate, no password and much more.

Adding Plugin

Create Facebook ID & Application

cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="YOUR_FB_APPID" --variable APP_NAME="YOUR_FB_APPNAME"

Example Code

function loginWithFB(){
  facebookConnectPlugin.login(["public_profile","email"],function(result){
    //calling api after login success
     facebookConnectPlugin.api("/me?fields=email,name,picture",
     ["public_profile","email"]
     ,function(userData){
         //API success callback
         alert(JSON.stringify(userData));
      },function(error){
         //API error callback
         alert(JSON.stringify(error));
      });
   },function(error){
      //authenication error callback
      alert(JSON.stringify(error));
     });
}

ReadMore

https://github.com/jeduan/cordova-plugin-facebook4

Sundaravel M

About the author: Hey! It's me sundar. (Yea, I'm the founder of codesundar.com). I'm a passionate computer programmer who loves modern web and mobile development. feel free to reach me : Facebook - Twitter - Google+