简体   繁体   中英

facebook login failure on iOS device

I am making an HTML5 app using cocoonjs, when trying to login into facebook as i click the login button it opens the facebook app or facebook website on safari, after this if i close the facebook app/safari then my app doesnt get notified of this kind of login failure

how do I detect this?

this is my code

if (this.socialService && !this.socialService.isLoggedIn()) { this.socialService.login(function(session) { self.log(session); if (session.status !== "connected") { console.log("not connected"); } }, { scope: "publicprofile,user_friends" }); } else { console.log("not connected"); }

The documentation for the Facebook js sdk has an example:

FB.login(function(response) {
  if (response.status === 'connected') {
    // Logged into your app and Facebook.
  } else if (response.status === 'not_authorized') {
    // The person is logged into Facebook, but not your app.
  } else {
    // The person is not logged into Facebook, so we're not sure if
    // they are logged into this app or not.
  }
});

Check the session.status of your code to check the conditions as shown in the example. If status is anything other than connected or not_authorized it could mean that the Facebook app/safari was closed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM