Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Method 1:</strong></p> <p>Though I believe that DMCS has given a correct solution to the problem, here is another way to approach. Use FB.login method with a custom login link.</p> <pre><code>&lt;script&gt; window.fbAsyncInit = function() { FB.init({ appId: 'YOUR-APP-ID', status: true, cookie: true, xfbml: true, oauth: true }); }; function facebookLogin() { FB.login(function(response) { if (response.authResponse) { console.log('Authenticated!'); // location.reload(); //or do whatever you want } else { console.log('User cancelled login or did not fully authorize.'); } }, { scope: 'email,user_checkins' }); } (function(d) { var js, id = 'facebook-jssdk'; if (d.getElementById(id)) { return; } js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; d.getElementsByTagName('head')[0].appendChild(js); } (document)); &lt;/script&gt; </code></pre> <p>Body markup:</p> <pre><code>&lt;div id='fb-root&gt;&lt;/div&gt;&lt;!-- required for SDK initialization --&gt; &lt;a id='fb-login' href='#' onclick='facebookLogin()'&gt;Login with Facebook&lt;/a&gt; </code></pre> <p>When you click on the button, it will run the callback function inside FB.login.</p> <p><strong>Method 2:</strong></p> <p>Alternatively, using FB login button plugin, you can subscribe to <code>auth.statusChange</code> and check for the status of the user in response.</p> <pre><code>FB.Event.subscribe('auth.statusChange', function(response) { // check for status in the response }); </code></pre> <p>Note if you are using fb login button plugin, and the user is already logged in and connected to the app, no login button is shown (read it in the documentation <a href="https://developers.facebook.com/docs/reference/plugins/login/" rel="noreferrer">here</a>)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload