Checking the Social Network Integration Status

Getting a list of integrated services

The following sample shows how you can get a list of social network services currently being linked to the user.

  • // Instantiate a user.
    var user = KiiUser.userWithURI("Set the URI of an existing user here");
    
    // Refresh the user.
    user.refresh({
      success: function(theUser) {
        // Get social network accounts linked to the user.
        var linkedAccounts = theUser.getLinkedSocialAccounts();
    
        if (linkedAccounts.hasOwnProperty("facebook")) {
          // A Facebook account is linked to this user.
        }
      },
      failure: function(theUser, errorString) {
        // Handle the error.
      }
    });
  • // Instantiate a user.
    var user = KiiUser.userWithURI("Set the URI of an existing user here");
    
    // Refresh the user.
    user.refresh().then(
      function(theUser) {
        // Get social network accounts linked to the user.
        var linkedAccounts = theUser.getLinkedSocialAccounts();
    
        if (linkedAccounts.hasOwnProperty("facebook")) {
          // A Facebook account is linked to this user.
        }
      }
    ).catch(
      function(error) {
        // Handle the error.
        var theUser = error.target;
        var errorString = error.message;
      }
    );