I am able to get the name and email like this:
FB.api('/me', function(response)
{
alert ("Name when logged in:" + response.name);
alert ("Name when logged in:" + response.email);
});
But in the FB documentation, I don't see how to get address. Also, how can I download their photo?
As I understand it, their photo can be retrieved from this url:
But how do I get their facebook user id?
Also, to get the address, I am trying something like this:
alert ("Location:" + response.location);
alert ("Location:" + response.location.city);
alert ("Location:" + response.location.country);
alert ("Location:" + response.location.zip);
alert ("Location:" + response.location.state);
But that doesn't work. Anyone know how to get at these fields? Thanks!
I am able to get the name and email like this:
FB.api('/me', function(response)
{
alert ("Name when logged in:" + response.name);
alert ("Name when logged in:" + response.email);
});
But in the FB documentation, I don't see how to get address. Also, how can I download their photo?
As I understand it, their photo can be retrieved from this url: http://graph.facebook./FACEBOOK_USER_ID/picture
But how do I get their facebook user id?
Also, to get the address, I am trying something like this:
alert ("Location:" + response.location);
alert ("Location:" + response.location.city);
alert ("Location:" + response.location.country);
alert ("Location:" + response.location.zip);
alert ("Location:" + response.location.state);
But that doesn't work. Anyone know how to get at these fields? Thanks!
Share Improve this question edited Aug 3, 2011 at 13:53 Genadinik asked Aug 3, 2011 at 13:07 GenadinikGenadinik 18.6k64 gold badges191 silver badges288 bronze badges 5- 2 You do realize that sounds very creepy. – Joseph Marikle Commented Aug 3, 2011 at 13:09
- 2 @Joseph its very mon. The user gives permissions to do this first. – Genadinik Commented Aug 3, 2011 at 13:17
- If this is to create one of those annoying 'See your top firends' type app then I vote no one helps him :P – Rob Quincey Commented Aug 3, 2011 at 13:17
- @Genadinik I see. Perfectly valid I suppose... but now I know why I never got into FB :P – Joseph Marikle Commented Aug 3, 2011 at 13:20
- @Joseph if you think about it, it is the same info as you would give when creating an account on many other sites. – Genadinik Commented Aug 3, 2011 at 13:24
2 Answers
Reset to default 3FB.api('/me')
Will give you the user's id without requiring any special permissions.
You can't get address as such, you can get location
using the user_location
permission. Then you'll be able to get it via the same /me
method.
Facebook Developers doc:
https://developers.facebook./docs/reference/api/user/
Actually all that info is here: http://developers.facebook./docs/reference/api/user/
But it took a long time to find that page!