title: Ask user to authenticate before submitting form with Facebook Javascript SDK
body: <p>I'm developing a Facebook Page Tab app where a user will be drawing on the page with HTML5 canvas.  When the user submits their drawing (basically a form), I need to check if the user has granted my app the necessary permissions.  If not, pop the Facebook dialog asking the user to authenticate with my app before submitting the form.  Once the user is authenticated (or if they already were), submit the form.</p>
  
  <p>In short, how can I submit a form only if the user has authenticated my app using Facebook Javascript SDK?</p>
  
  <p>UPDATE:</p>
  
  <p>I was able to solve this using FB.getLoginStatus and FB.Login per Shaun's suggestion.  Here's an example:</p>
  
  <pre><code>$('#submit').on('click', function() {
          FB.getLoginStatus(function(response) {
                  if (response.status === 'connected') {
                      // User authenticated, submit the form
                  } else if (response.status === 'not_authorized') {
                      // the user is logged in to Facebook,
                      // but has not authenticated your app
                      FB.login(function(response) {
                          // handle the response
                      }, {scope: 'email,'});
                  } else {
                      // the user isn't logged in to Facebook.
                      FB.login(function(response) {
                          // handle the response
                      }, {scope: 'email,'});
                  }
              });
          });
  </code></pre>