views:

237

answers:

1

Trying to do 2 things

request offline and user_events permission perminant session key

Need a feed from facebook for events and there is no rss for it. Any help would be greatly appreciated!!!

Currently have the following

<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"&gt;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <!--<title>Connect JavaScript - jQuery Login Example</title>-->
  </head>
  <body>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
  <script src="http://connect.facebook.net/en_US/all.js" type="text/javascript"></script>
    <div>
      <button id="login">Login</button>
      <button id="logout">Logout</button>
      <button id="disconnect">Disconnect</button>

    </div>

    <div id="fb-root"></div>

    <script type="text/javascript">
        // initialize the library with the API key
        FB.init({ apiKey: 'apikey' });

        // fetch the status on load
        FB.getLoginStatus(handleSessionResponse);

        $('#login').bind('click', function () {

            FB.Connect.showPermissionDialog('publish_stream');

        });

        $('#logout').bind('click', function () {
            FB.logout(handleSessionResponse);
        });

        $('#disconnect').bind('click', function () {
            FB.api({ method: 'Auth.revokeAuthorization' }, function (response) {
                clearDisplay();
            });
        });

        // no user, clear display
        function clearDisplay() {
            $('#user-info').hide('fast');
        }

        // handle a session response from any of the auth related calls
        function handleSessionResponse(response) {
            // if we dont have a session, just hide the user info
            if (!response.session) {
                clearDisplay();
                return;
            }

            // if we have a session, query for the user's profile picture and name
            FB.api(
          {
              method: 'fql.query',

              //Event pull
              query: 'SELECT eid, name, tagline, pic_big, host, description, event_type, event_subtype, start_time, end_time, creator, location, venue FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid =' + FB.getSession().uid + ')'

          },

          function (response) {
              var user = response[0];

              $('#user-info').html('eid: ' + user.eid).show('fast');

          }
        );
        }
    </script>

  </body>
</html>
A: 

I don't think this helps with your entire issue, however the login code i've used in the past looks something more like this:

$('#login').bind('click', function () {
    FB.init({appId: "<appid goes here>", status: true, cookie: true});
    FB.login(function(response) {
    if (response.session) {
            // user logged in, do whatever here
        } else {
            // user cancelled login
        }
    },{perms:"offline_access,user_events"});

    return false;
});
Benjamin Pearson