The Basics

jQuery Plugin to simplify the process of requesting Facebook permissions, such that you only proceed forward in sign-up once the user has granted all you require.


Basically just include the file and set up the Facebook API on the page.

<script src="//"></script>
<script src="/libs/jquery-facebook-authorize/jquery.facebook-authorize.min.js"></script>

window.fbAsyncInit = function() {
        cookie  : true,
        xfbml   : true, /* parse social plugins on this page. */
        version : 'v2.5'

(function(d, s, id){
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement(s); = id;
    js.src = "//";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

<div id='error_msgs'></div>

<div class='row'>
  <button id='facebook_request' class="btn btn-default" style="color:#0b62a4;">
    <i class="fa fa-facebook-square"></i> Login with Facebook

    $(function() {
        var $fbreq = $('#facebook_request');

        var options = {required : ['public_profile', 'email', 'user_friends', 'publish_actions'],
                       optional: []};

        $fbreq.on('facebook-request-clicked', function(event) {
        $fbreq.on('facebook-missing-required', function(event, missing) {
            $('#error_msgs').text('missing: ' + JSON.stringify(missing));
        $fbreq.on('facebook-success', function(event, granted, missing, details) {
            /* move the user onto whatever step applies. */
            createOrLogin(granted, details);
        $fbreq.on('facebook-not-authorized', function(event) {
            $('#error_msgs').text('not authorized');
        $fbreq.on('facebook-not-loggedin', function(event) {
            $('#error_msgs').text('not logged in...');


Name Type Default Description
required array [] List of required permissions.
optional array [] List of optional permissions.


Event Handler
facebook-request-clicked function(event):
- event - jQuery event
facebook-missing-required function(event, missing):
- event - jQuery event
- missing - comma separated string of missing required permissions
facebook-success function(event, granted, missing, details):
- event - jQuery event
- granted - comma separated string of all permissions granted
- missing - comma separated list of any missing optional permissions
- details - Facebook API response.authResponse object
facebook-not-authorized function(event):
- event - jQuery event
facebook-not-loggedin function(event):
- event - jQuery event


Apache License 2.0