Developers Manual > SDK Integration > Facebook > Facebook API References in JavaScript > Facebook-isLoggedIn

.isLoggedIn()

Check the user's authorization status. false if the user has not logged into Facebook, or hasn't authorized your app; true otherwise. Most often, this will be in the logic that determines whether to show a login control.

Example

1
2
3
4
5
6
var facebook = plugin.FacebookAgent.getInstance();
if (facebook.isLoggedIn()) {
    // Get data from Facebook to personalize the player's experience
} else {
    // Prompt the user to log in, or offer a "guest" experience
}

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.