Paid Facebook plugin issue


#1

This happens on the newest Samsung android phone, probably on older devices too, I just don’t have them. Facebook is not installed. First login using webview happens successfully, webview popup shows up and everything works. However, consecutive logins do not work. Basically, webview that notifies you that you have already given permissions to this app shows up, user clicks ok, nothing happens in the app. No error messages, nothing! This is in production, so it’s kinda urgent.

This scenario does not happen on iPhone. Sometimes authentication fails when Facebook redirects back to the app, but I just retry a couple of times in the code and it’s good enough.

Any help is appreciated,
Norm


#2

I have this working, so maybe I can help. Can you paste code?


#3

Hey Ben,

Just saw your reply. Here is the code:

        steroids.addons.facebook.ready
            .then(function () {
                return new Promise(function (resolve, reject) {
                    steroids.addons.facebook.login(['public_profile', 'email'])
                        .then(function (response) {
                            return resolve(response);
                        })
                        .catch(function(err) {
                            // NOTE: steroids.addons.facebook.login fails very often due to unknown reason
                            // therefore, we give it a second chance when it fails
                            utils.logWarning('Trying steroids.addons.facebook.login second time');
                            steroids.addons.facebook.login(['public_profile', 'email'])
                                .then(function (response) {
                                    return resolve(response);
                                })
                                .catch(function(err) {
                                    utils.logError('steroids.addons.facebook.login failed twice in a row: ' + err);
                                });
                        });
                });
            }).then(...);

#4

Let me know if you need more details, I’ll provide ASAP!


#5

Do you check steroids.addons.facebook.getLoginStatus() first? That’s the only major difference in what I do. Also I don’t use the response from login(), I call steroids.addons.facebook.getAccessToken() after successful login().


#6

Thanks Ben, I’ll test and will let you know if it worked or not.


#7

Hey Ben,

steroids.addons.facebook.getLoginStatus() always returns the following object for me:

{“status”: “unknown”}

I think that’s why I wasn’t using it previously, it is not very helpful. Any ideas on this?

Norm


#8

Ok! When i receive “unknown” i just force users to login again… not perfect but works!
THANKS BEN!!!


#9

Gald you got it working :slight_smile: