Wizcorp / phonegap-facebook-plugin

The official plugin for Facebook in Apache Cordova/PhoneGap
Other
1.91k stars 2k forks source link

Always login with developer account althoug i try to login different facebook accounts #1352

Open casa90 opened 7 years ago

casa90 commented 7 years ago

My problem is that when I login I use different facebook accounts, but login data is always developer facebook accounts data.

var success = function (data) {           
            console.log(data);
            return;
            var namesurname = data.name;
            var array = namesurname.split(" ");
            var name = array[0];
            var surname = array[1];
            var email = data.email;
            var id = data.id;
            var photo = "https://graph.facebook.com/" + id + "/picture?type=large";
            var item = {
                facebookId: id,
                name: name,
                surname: surname,
                email: email,
                photo: photo,
                username: null,
                password: null,
                deviceId: deviceId,
                deciveName: deviceName,
                deviceType: deviceType,
                authType: "Facebook"
            }

            $.ajax({
                type: 'POST',
                url: LoginUrl,
                data: JSON.stringify(item),
                success: function (data, status, xhr) {

                    if (data.Status == 200) {
                        localStorage.setItem("userId", data.Result);
                        window.location.href = "Home.html";
                    }
                    else {                        
                        return;
                    }
                },
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                beforeSend: function () {},
                complete: function () {}
            });

        }
        var failure = function (error) {            
            console.log(error);

        }
        var fbLoginSuccess = function (userData) {
            console.log(userData);
            facebookConnectPlugin.api(userData.authResponse.userID+"?fields=id,name,picture,email", ["public_profile", "email"], success, failure);
        }
        document.getElementById("login").onclick = foo2;
        function foo2(){facebookConnectPlugin.login(["public_profile"],fbLoginSuccess,function(error) {console.log("" + error);});}