Get Facebook Friends with Geddy-Passport

178 views
Skip to first unread message

Eric Ponce

unread,
Apr 28, 2013, 9:05:51 PM4/28/13
to ged...@googlegroups.com
Hello!

I'ts possible to get the facebook friends when we do login with geddy-passport and facebook?
thanks!!!

Eric Ponce

unread,
May 2, 2013, 1:28:56 PM5/2/13
to ged...@googlegroups.com
Matthew its possible or geddy-passport dont support this?
thanks!

Matthew Eernisse

unread,
May 3, 2013, 1:01:26 AM5/3/13
to ged...@googlegroups.com
I'm not sure exactly what the Facebook API supports, but I would guess getting a list of friends should be possible.

I can't check at the moment what Facebook gives Passport back in the response, as Facebook auth seems to be broken. Twitter still works fine, so I'm going to assume FB broke compatibility in their response somehow.

Probably what we need to do is to stash the OAuth token in the user's session as well as the local userId, so you can make calls to the FB API and ask for stuff like the friends list.

But first, I'll have to fix Facebook auth. :)


--
The official community discussion group.
website: geddyjs.org, source: https://github.com/mde/geddy, group: https://groups.google.com/d/forum/geddyjs?hl=en
---
You received this message because you are subscribed to the Google Groups "GeddyJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geddyjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Eric Ponce

unread,
May 3, 2013, 10:22:12 AM5/3/13
to ged...@googlegroups.com
thanks matthew!

This is the Graph API function https://developers.facebook.com/docs/reference/api/user/#friends but I need the acces token


El lunes, 29 de abril de 2013 03:05:51 UTC+2, Eric Ponce escribió:

Miguel Madero

unread,
May 3, 2013, 4:38:37 PM5/3/13
to ged...@googlegroups.com
I did something similar in Rails and you guys are on the right track, all you need is to store that access token somewhere. 

Miguel


--

Eric Ponce

unread,
May 5, 2013, 5:13:39 PM5/5/13
to ged...@googlegroups.com
Miguel how can I save the acces token? Where is it?

Matthew Eernisse

unread,
May 9, 2013, 11:15:54 PM5/9/13
to ged...@googlegroups.com
I just realized the reason FB auth wasn't working was because I'd revoked the creds for the app I was testing with. I'll take a look at getting easy access to the access token.

Eric Ponce

unread,
May 10, 2013, 11:08:58 AM5/10/13
to ged...@googlegroups.com
Oh thanks matthew!!!! :D

Eric Ponce

unread,
May 10, 2013, 12:56:42 PM5/10/13
to ged...@googlegroups.com
One thing more. When I do a login with Facebook, in the console the callback show this: http://i.imgur.com/5QF7yqT.png
Is the access token?

Matthew Eernisse

unread,
May 10, 2013, 4:51:26 PM5/10/13
to ged...@googlegroups.com
All right, I've updated Geddy-Passport so that when you log in with a third-party service (e.g., Facebook), you get an 'authData' session variable that holds any tokens that Passport initially used for retrieving the profile from the service. You should be able to use that data to make API calls using geddy.request, or whatever request library you want to use.

These changes are in geddy-passport v0.0.21.


Eric Ponce

unread,
May 11, 2013, 8:25:57 PM5/11/13
to ged...@googlegroups.com
Yeah! Success! :D

If someone need to do the same, this is my code:
We need "request", install it with "npm"

if(self.session.get('authData')){
    request({
      uri: "https://graph.facebook.com/me/friends?access_token=" + self.session.get('authData').token,
      method: "GET",
      timeout: 10000
    }, function(error, response, body) {
        var fb = JSON.parse(body);
        //show friends list
        console.log(fb.data);
    });
}

thanks Matthew!!! ;)

Eric Ponce

unread,
May 11, 2013, 11:44:43 PM5/11/13
to ged...@googlegroups.com
Matthew, wich is the best method to do an geddy auth update?
Now my deployed app crashes :S

thanks!!

Eric Ponce

unread,
May 16, 2013, 11:31:25 AM5/16/13
to ged...@googlegroups.com
Imagine that I have a Geddy App, with the old Geddy auth.
If I do "geddy auth" all my edited files from the auth part (helpers in major part) will be reedited and I'll lost my process.
How can I do it for update this without problems?

thanks a lot! ;)

Matthew Eernisse

unread,
May 17, 2013, 12:18:14 AM5/17/13
to ged...@googlegroups.com
This is a general problem with code-generation. You have to track the customizations you've made, and re-apply them whenever you update from the source.

You can run the auth generator in a fresh app, and compare the difference with what you have. Or, if you've been tracking your changes to the generated code, do a diff from when you first run the auth generator to see what your customizations are, and re-apply them after you do your update.

Hope that helps.

Eric Ponce

unread,
May 17, 2013, 10:04:08 AM5/17/13
to ged...@googlegroups.com
thanks Matthew. i'll do this
Reply all
Reply to author
Forward
0 new messages