Log In
Status:
waiting
|
Disconnect
|
Logout
<h1>Login Status</h1> <p>These examples show you how to retrieve a person's login status, and to track any changes to that status. </p> <h2>Checking Login Status</h2> <p>The <a href="https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus">FB.getLoginStatus()</a> function in the SDK will return the current login status of the user, and this example will show that response status in the log (look for 'Status Response' entries).</p> <script> FB.getLoginStatus(function(response) { Log.info('Status Response', response); }); </script> <h2>Tracking Status Changes</h2> <p>The <a href="https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/">FB.Event.subscribe()</a> function can be used to track auth.StatusChange events which will fire whenever a user's login status changes in any way. Try using the login button below to log in, or log out and see how each change fires an event (look for 'Status Change Event' entries in the log):</p> <script> FB.Event.subscribe('auth.statusChange', function(response) { Log.info('Status Change Event', response); }); </script> <div class="fb-login-button" data-max-rows="1" data-size="medium" data-auto-logout-link="true"></div> <h3>Related Guides</h3> <p>Read <a href="https://developers.facebook.com/docs/facebook-login/login-flow-for-web/">our guide to using the JavaScript SDK for Facebook Login</a> to see the best way to use Facebook Login.</p>
Examples
Website
Website
Canvas
Page Tab
Run Code
Clear