0

I have written this firebase login code for using connect with facebook on a form. My problem is after doing first connect with facebook when I do another one on same browser, it automatically gets accessToken & id for previous login. I want it to ask for email-id & password any time or have a confirmation that this is indeed their facebook account. How can I do that?

var ref2 = new Firebase("https://<db-name>.firebaseio.com/users/" + $scope.phone);
        //var msg = {};
        var auth = new FirebaseSimpleLogin(ref, function(error, user) {
          if (error) {
            // an error occurred while attempting login
            console.log('an error occurred:');
            console.log(error);
          } else if (user) {
            // user authenticated with Firebase
            console.log('logged in:');
            console.log(user);
            msg = {
              username: $scope.username,
              accessToken: user.accessToken,
              id: user.id
            };

            //$scope.messages.$add(msg);
            ref2.set(msg);

          } else {
            // user is logged out
            console.log('logged out');
          }
        }); // Note: Attach this to a click event to permit the pop-up to be shown
        auth.logout();
        auth.login('facebook');
rishiag
  • 2,248
  • 9
  • 32
  • 57

1 Answers1

2

This is a Facebook feature, if the cookie is available from the previous login, it will issue an oauth token without prompting for login. You will need to explicitly logout of Facebook when you logout of your app; for your app to always request you the username password.

More discussion on this link here: Facebook Oauth Logout

Community
  • 1
  • 1
Satish P
  • 514
  • 2
  • 6