Cordova Facebook Login

Cordova plugin facebook allows the developers to enable social login for their applications. this plugin is used for 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 this 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
            ["public_profile", "email"],
            function(userData) {
                //API success callback
            function(error) {
                //API error callback
    }, function(error) {
        //authenication error callback