Not getting facebook email - c#

I'm using the Facebook C# SDK for build an website with some facebook integration and I'm having some problems with getting the email from an facebook user.
I ask for these permissions:
email,user_birthday,user_about_me,user_relationships,publish_stream,offline_access,user_location
And when asking for fields I ask for these:
id,first_name,middle_name,last_name,picture,email,birthday,location,gender,friends,bio
This is allready live an in most cases there is no problem at all. But in some cases about 1/100 I don't get the email field but all the others fields are there.
Do any one know how this can happen?
I tested with different privacy settings and with multiple facebook accounts.
Ole Dallerup Sørensen

Just like you said, some people have their privacy settings set up so that Facebook proxies any emails to them. This means despite them granting you the permission you will still not get their email address.

I found an solution to my problem for now.
Instead of using the graph api I run an fql query and this gives me the email.
the fql:
SELECT email FROM user WHERE uid = me()

Related

How to recognize returning Facebook User using the Facebook Login Widget

I am implementing the Facebook Login widget inside my ASP.NET 4.5 C# web application. When I clicked the login button I eventually get the accessToken. My question is regarding making the user persistant in my application.
There is data that is associated with the specific facebook user. when the user log off and log in back (assuming that the cookie might be deleted), I want to be able to recognize him again to display the relevant information.
I know that I need to use the database, but what is the best practice to do so. Should I use the user ID or email address as a unique user identification string?
I am using MySQL as the backend.
I have been working on a similar application which uses either Facebook (OAuth), Google (OpenId) or a manual registration login approach.
My prefered solution was to ask the user for their email address, you will need to request extended permissions on the email field from Facebook as it is not offered up by default.
http://developers.facebook.com/docs/authentication/permissions
My table structure looks like this.
User
Id (int)
Email (nvarchar(256))
FacebookToken (nvarchar(256))
GoogleToken (nvarchar(256))
The advantage to this method is you are able to link up your users to the right account if you decide later to add another authentication / identification service or roll your own. It won;t matter if they login to FB, Google or Twitter - you always know whcih account to attach them to.
It is also useful to have an email address for each of your users regardless.
Regards
Steve

Facebook merge registration c#/MVC3

I can't believe I'm asking this, since it apparently should be very simple.
I'm building a website, where I'd like my own user database to be able to "connect"/merge with a facebook profile.
That means, both users with and without facebook is allowed.
But I cannot for the life of me, figure out, how I join existing users in my database with facebook profile?
I've seen the flowchart on developers.facebook which is exactly what I need, but I can't figure out what to do to merge. What do I need to do in my database? and how do I capture the information I need from the registration plugin to merge?
I've read a lot here:
http://developers.facebook.com/docs/plugins/registration/
But I can't see the connection.
When people register via Facebook they are doing 2 things - they are connecting to your Facebook App (the one you created to get an App Id and App Secret) and they are registering on your site.
If they have registered on your site but not connected via Facebook, Facebook doesn't have any way of knowing that so it falls on you to figure it out. They'll go through the registration process as if they were a new user, but when you get the data you should check and see if you have a user that matches already. How you do that is up to you. Maybe they were already logged in normally and so you have their user id or something internal like that. Maybe they weren't and you have to see if the email address used is already in the database. How you then create their account or add any extra data you just gained from Facebook is up to you.
To get the data you'll have to process the signed_request POST variable which will have all the data on it. This is when you look at the email address or whatever fields you want to use to determine if the user already exists or not.
You should also be creating the new user in your database at this time. How you do that is again up to you.
Remember, Facebook is making the collecting of data easier as it imports things like name, email, birthday, etc for you so users don't have to type it all in. It's still up to you to create the user and do whatever you do on your end.
Connecting through Facebook will connect them with your app but you'll still need to create an account for them.

Windows Live / Hotmail retrieve Contacts' Emails

after I did some research on the subject, I found that Windows Live stopped providing email addresses for a user's contacts through its API. Instead, they provide the email hashes.
I did a little more research, and i found many websites being able to retrieve the contact list for a user and displaying it (with emails, not hashes) but the difference is that i don't think they are using oAuth since to retrieve the emails, the user must provide his email/password.
I need to implement importing a user's contact list on my site and i see no workaround to doing it using oAuth REST requests through Live's API (granted that i was being able to get the access token and make other REST requests).
If not using oAuth, what are other ways of getting a Windows Live/Hotmail contact list?
I ended up using Windows Live ID's Delegated Authentication. Even tho it's deprecated it'll have to do until i find a more effective solution.

Is there a way to get the email address associated with a Windows Live ID?

I have a client that wants to use Windows Live ID Delegated Authentication SDK 1.2 to provide authentication for their website.
The architecture that they proposed was to have a database table that contained the email addresses of users who were authorized to use the site. Once the user logged using Windows Live ID web authentication, they wanted to compare the email address associated with that live ID to the table and allow/disallow the user access to the site based on that.
Is this possible? I can't find any documentation that talks about how to get the email address associated with the Windows Live ID.
I was originally looking for the way to do this with the Rest API, but it doesn't seem to work.
Using "wl.basics, wl.emails" solved the problem, albeit I don't have a fallback for when javascript is disabled.
Example from Rup:
http://isdk.dev.live.com/ISDK.aspx?category=Core+Concepts&index=1

download gmail contacts

There are lots of script like invite friends script which requests users to provide their google/other account id and password and automatically downloads all email accounts and sends an email invitation automatically. So, how to download email address using ASP.NET C# by providing login details?
Use the Google contacts API.
Here is a .NET example of retrieving contacts
Good luck :)
You have a special API for that. Try Googling for it. Can can find the best. Else u can use open invite or email invite 2.1

Categories