Get User Email id on clicking FaceBook 'Like' button? - facebook

I want the email address of the user when he/she clicks on the facebook Like button.
Here is the code I'm using:
FB.Event.subscribe('edge.create', function(response) {
// like clicked
});
But the response only has the HREF.
How do I do this?

Simply you can't!
Even if the user is going to allow/authorize your application and you were asking for their emails (email permission), users may choose not to share it with you and provide you a proxied Facebook email address instead!

Related

How can I identify Facebook users that don't use my app yet?

I'm developing an app in which users log with their Facebook account, but only the Facebook profiles that the system administrator have previously entered.
In other words, the system admin enters a bunch of Facebook profiles, and when the user tries to log into my app, the system checks if there's a record for that Facebook profile.
I used to do this using the user's Facebook username, because the admin could get that information easily from a Facebook profile's URL, and Facebook provided that username when the user logged in. This is not possible anymore with Graph API 2.0, because Facebook does not provide the username field anymore.
So do you guys have any suggestion on how the system administrator could easily identify users, so they would be granted access in my app?
#WizKid is right, using the user's email is the best way to do this. Any user will be able to login, but then you can build in a check to see if that user's email is in your "pre-approved" list.
To get the user's email address, you need to ask them for it in the login dialog using the scope parameter. In the JS SDK, it looks like this:
FB.login(function (response) {
// handle response
}, { scope: "email" }); // <<< the important bit
Note: with the new Graph 2.0 Login dialog, a user can choose not to provide their email address by unchecking it in the "edit the info you provide" section of the dialog. As a result you'll need to double check that the user actually provided their email address.

Facebook send dialog link gets removed in recipient's inbox

I have a site that uses the Facebook Send Dialog for users to send messages to each other. I call this:
FB.ui({
method: 'send',
to: user.id,
link: 'http://www.nytimes.com/'
});
This brings up the dialog and if the user clicks send, the message is sent.
That's great but the link (what Facebook calls the attachment) does not show in the recipient's inbox. In its place is a warning box with the text
"This attachment may have been removed or the person who shared it may not have permission to share it with you.".
I'm not sure why the link isn't working. I don't think there is any permission involved because the Facebook documentation says that the Send Dialog does not need permissions. Regardless my app already has the publish_actions permission. Has anyone seen this before?

Can I force users to complete registration after facebook login, is it against TOS?

Question in simple, I have facebook app, thich is basically my site 1:1, but in facebook iframe.
I want to show a user a registration form after he logs in with facebook, containing the most common fields - username, email, password. After registration, I want to save facebook ID and create profile for this user.
Isn't it against facebook TOS to ask for username / password / email after user has entered site through facebook?
Thabks
Why should it be against anything? They don't have to fill this form and proceed with registration on your website, so they're not really forced to do this.
In your FB app's settings, on App Details page there are textboxes for link to privacy policy and terms of service of your app. I think that you have to write in your own PP and TOS why you're asking for this data and what about privacy and all this stuff. And, of course, you should link to your app's PP and TOS on register page, or even "everywhere" in the footer so users will by able to check them easily.

open friends request when user clicks allow in Facebook connect

I allow users to use facebook connect to login to facebook and then give permission to my app.
When they click allow I want the multi-friend's selector to open so they can invite friend's to the site. I need the permissions dialoge first so I can get the user_id's of the users the person invited.
Is there a way to open the multi-friend's selector when the user clicks allow?
Hi when the user aunthenticate your application, it logins to your site, You can capture the event of login and can send him to any other url where you can put friend selector.
FB.Event.subscribe("auth.login", function(response) {
//send to some url(file) and put there friend selector
});

How to get user e-mail addressess that clicked like button for blog entries or pages with Facebook Open Graph Protocol?

I have implemented Facebook Open Graph Protocol Full Integration following the http://developers.facebook.com/docs/opengraph/ and http://www.websitedesign411.com/blog/facebook-open-graph-protocol-full-integration-walkthrough.
How can I get user e-mail addressess that clicked the like button for certain blog entries or pages?
You can't. Access to the email address requires prompting the user for extended permissions. You can't get that information through a simple "Like" action. That would be a spammers dream!
http://developers.facebook.com/docs/authentication/
I don't believe you can access a facebook user's email address just because they clicked on your Like button. What you will need to do is get the user to authenticate to your application using facebook connect (usually by clicking on that blue "Connect" button), and in the process you can prompt them to share their email address. Email is an 'extended permission' so you need to ask explicitly for it.
You can implement this authentication bit easily enough with the facebook javascript SDK:
http://developers.facebook.com/docs/reference/javascript/
Once the user has authenticated to your application allowed access to their email you can can fetch their email address via the graph api:
http://developers.facebook.com/docs/reference/api/user/
The easiest way to communicate with folks who like your page is to post interesting messages on your page's wall leading them to your facebook app.
You then get them to authorize your app (with or without extended permissions).
Once authorized, you are able to communicate several ways like:
using livemessage
http://developers.facebook.com/docs/reference/rest/livemessage.send/
create an event and add their user id to it.
BTW, the way to get their user ids is:
1) getting the object id of your page/url using
https ://graph.facebook.com/?id={URL}
2) retrieving the user ids via
https: //graph.facebook.com/{mypageid}/likes