Facebook Connect shows browser page not app page

Hi,
I’m very new to ionic / angularjs / cordova.
I’m trying to connect ionic/angularjs via ngCordova to facebook. when i connect to facebook, it shows me browser facebook login. i want to show app login page. how can i do that?

regards,
-Navi

this is because of OAUTH authentication. This is how authentication via facebook works… you can only authenticate a facebook user from the facebook WEBSITE

I’m using this plugin http://ngcordova.com/docs/plugins/facebook/
By the way, because it’s using Cordova that mean is using native features, do not run in browser.

yes donny you are right as im using cordova, should invoke native facebook app not browser page.
i tried using that plugin but getting following error

ReferenceError: facebookConnectPlugin is not defined

also how can i correctly authenticate with facebook using above plugin? will be thankful if you can share codes

regards,

-Navi

Did you think error like this

I’ve similar error, but it’s works in actual devices like android or ios. by the way, u can leave the config empty, because the plugin will read go straight to plist file in your xcode project

i fixed that by adding facebookConnectPlugin.js file but another error coming which is

Uncaught ReferenceError: require is not defined

can u please share with me working codes?

thanx

Yes sure,

First u have to register the plugin and facebook data

cordova platform add ios

cordova -d plugin add /Users/your/path/here/phonegap-facebook-plugin --variable APP_ID="123456789" --variable APP_NAME="myApplication"

login.js

$scope.facebookLogin = function() {
        $cordovaFacebook.login(["public_profile", "email"])
        .then(function(response) {
            if (response.authResponse) {
                $cordovaFacebook.api("me", ["public_profile"])
                .then(function(success) {
                    if(success.verified){
                        $ionicLoading.show({
                          template: 'Authentication...'
                        });
                        
                        // success
                        console.log("facebook data", success);
                        });

                    }else{
                        //logout account
                        //$cordovaFacebook.logout();
                        //account must be verified
                        alert("Error", "Please verfied your Facebook account");    
                    }
                    
                }, function (error) {
                    alert("Error", error);
                });
             }
        }, function (error) {
            alert("error", error);
        });   
    };

i hope it will help you,
By the way, everything you need has been documented. take your time to read more about it :wink:
http://ngcordova.com/docs/plugins/facebook/