Implementing Facebook login

I am trying to do a Facebook login but I am failing in every single try.

I used this tutorial https://www.firebase.com/blog/2014-07-25-ionic-simple-login.html

and I am able to login with Facebook but only when I am in a Browser, I mean, when I use Ionic with $ ionic serve, I already upload my app to view it in Ionic View, and I can not login from my iPhone, so, what can I do here ? do you know any new tutorial to accomplish this ?

Why you use firebase tutorial to make facebook login?)))
look at this cordova plugin http://ngcordova.com/docs/plugins/oauth/ - it should help)

1 Like

OK, I have a question because there is some stuff I don’t understand

“When registering your application with various service providers such as Facebook or Google, it is very important to use http://localhost/callback as the callback / redirect uri. The Oauth module depends on this in order to complete the browser flow.”

what callback they talk about ? can you give me a better idea ?

and here

    module.controller('MyCtrl', function($scope, $cordovaOauth) {
        $scope.facebookLogin = function() {
            $cordovaOauth.facebook("CLIENT_ID_HERE", 
                                    ["email"]).then(function(result) {
                // results
            }, function(error) {
                // error
            });
        }
    });

what is the CLIENT_ID ??? is the Facebook App ID or what ? and what about the email ? do I have to change that ?

You need to create facebook app and you’ll receive Facebook App ID.
Email in that example is a user data you want to receive from facebook.

1 Like