Permalink
Browse files

fb route

  • Loading branch information...
iplanwebsites committed Mar 29, 2012
1 parent 78f883b commit 5a8e8ed14b13b9eaf1255c375b8ae01644976768
Showing with 30 additions and 5 deletions.
  1. +5 −1 views/index.ejs
  2. +25 −4 web.js
View
@@ -111,7 +111,11 @@
// window.location.reload() because if this is in a canvas there was a
// post made to this page and a reload will trigger a message to the
// user asking if they want to send data again.
- window.location = window.location;
+
+
+ console.log('user logged!');
+ console.log(FB);
+ window.location = window.location; //refresh current page... (shitty behavior.)
});
FB.Canvas.setAutoGrow();
View
29 web.js
@@ -50,11 +50,11 @@ var app = express.createServer(
express.bodyParser(),
express.cookieParser(),
// set this to a secret value to encrypt session cookies
- express.session({ secret: process.env.SESSION_SECRET || 'topsecret123456' }),
+ express.session({ secret: process.env.SESSION_SECRET || 'topsecret55887456' }),
require('faceplate').middleware({
app_id: process.env.FACEBOOK_APP_ID,
secret: process.env.FACEBOOK_SECRET,
- scope: 'user_likes,user_photos,user_photo_video_tags'
+ scope: 'user_likes,user_photos,user_photo_video_tags,email,user_work_history,offline_access' //TODO: offline_access is deprecated now.
})
);
@@ -111,7 +111,7 @@ function handle_facebook_request(req, res) {
async.parallel([
function(cb) {
// query 4 friends and send them to the socket for this socket id
- req.facebook.get('/me/friends', { limit: 4 }, function(friends) {
+ req.facebook.get('/me/friends', { limit: 20 }, function(friends) {
req.friends = friends;
cb();
});
@@ -123,9 +123,16 @@ function handle_facebook_request(req, res) {
cb();
});
},
+ function(cb) {
+ // query 16 photos and send them to the socket for this socket id
+ req.facebook.get('/me/', { }, function(photos) {
+ req.me = me;
+ cb();
+ });
+ },
function(cb) {
// query 4 likes and send them to the socket for this socket id
- req.facebook.get('/me/likes', { limit: 4 }, function(likes) {
+ req.facebook.get('/me/likes', { limit: 20 }, function(likes) {
req.likes = likes;
cb();
});
@@ -166,6 +173,20 @@ app.post('/posttest', function(req, res){
res.send(req.body);
});
+
+app.get('/me', function(req, res){
+ async.parallel([
+ function(cb) {
+ // query 4 friends and send them to the socket for this socket id
+ req.facebook.get('/me', { }, function(me) {
+ req.me = me;
+ cb();
+ });
+ }
+ ], function() {
+ res.send(req.me);
+ });
+});
///////////////////////////////////////////////////////////////////
// Geo Location API V1
////////////////////////////////////////////////////////////////

0 comments on commit 5a8e8ed

Please sign in to comment.