Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fb route

  • Loading branch information...
commit 5a8e8ed14b13b9eaf1255c375b8ae01644976768 1 parent 78f883b
I Plan Websites authored March 29, 2012

Showing 2 changed files with 30 additions and 5 deletions. Show diff stats Hide diff stats

  1. 6  views/index.ejs
  2. 29  web.js
6  views/index.ejs
@@ -111,7 +111,11 @@
111 111
           // window.location.reload() because if this is in a canvas there was a
112 112
           // post made to this page and a reload will trigger a message to the
113 113
           // user asking if they want to send data again.
114  
-          window.location = window.location;
  114
+          
  115
+          
  116
+          console.log('user logged!');
  117
+          console.log(FB);
  118
+          window.location = window.location; //refresh current page... (shitty behavior.)
115 119
         });
116 120
 
117 121
         FB.Canvas.setAutoGrow();
29  web.js
@@ -50,11 +50,11 @@ var app = express.createServer(
50 50
   express.bodyParser(),
51 51
   express.cookieParser(),
52 52
   // set this to a secret value to encrypt session cookies
53  
-  express.session({ secret: process.env.SESSION_SECRET || 'topsecret123456' }),
  53
+  express.session({ secret: process.env.SESSION_SECRET || 'topsecret55887456' }),
54 54
   require('faceplate').middleware({
55 55
     app_id: process.env.FACEBOOK_APP_ID,
56 56
     secret: process.env.FACEBOOK_SECRET,
57  
-    scope:  'user_likes,user_photos,user_photo_video_tags'
  57
+    scope:  'user_likes,user_photos,user_photo_video_tags,email,user_work_history,offline_access' //TODO: offline_access is deprecated now.
58 58
   })
59 59
 );
60 60
 
@@ -111,7 +111,7 @@ function handle_facebook_request(req, res) {
111 111
     async.parallel([
112 112
       function(cb) {
113 113
         // query 4 friends and send them to the socket for this socket id
114  
-        req.facebook.get('/me/friends', { limit: 4 }, function(friends) {
  114
+        req.facebook.get('/me/friends', { limit: 20 }, function(friends) {
115 115
           req.friends = friends;
116 116
           cb();
117 117
         });
@@ -124,8 +124,15 @@ function handle_facebook_request(req, res) {
124 124
         });
125 125
       },
126 126
       function(cb) {
  127
+        // query 16 photos and send them to the socket for this socket id
  128
+        req.facebook.get('/me/', { }, function(photos) {
  129
+          req.me = me;
  130
+          cb();
  131
+        });
  132
+      },
  133
+      function(cb) {
127 134
         // query 4 likes and send them to the socket for this socket id
128  
-        req.facebook.get('/me/likes', { limit: 4 }, function(likes) {
  135
+        req.facebook.get('/me/likes', { limit: 20 }, function(likes) {
129 136
           req.likes = likes;
130 137
           cb();
131 138
         });
@@ -166,6 +173,20 @@ app.post('/posttest', function(req, res){
166 173
   res.send(req.body);
167 174
 });
168 175
 
  176
+
  177
+app.get('/me', function(req, res){
  178
+  async.parallel([
  179
+    function(cb) {
  180
+      // query 4 friends and send them to the socket for this socket id
  181
+      req.facebook.get('/me', { }, function(me) {
  182
+        req.me = me;
  183
+        cb();
  184
+      });
  185
+    }
  186
+  ], function() {
  187
+    res.send(req.me);
  188
+  });
  189
+});
169 190
 ///////////////////////////////////////////////////////////////////
170 191
 //    Geo Location API V1
171 192
 ////////////////////////////////////////////////////////////////

0 notes on commit 5a8e8ed

Please sign in to comment.
Something went wrong with that request. Please try again.