Get facebook username using c#

Hi is there any way where i can get user's facebook username using their email and password? I have already done the authentication for user to login with facebook but i need a way to get the username and store it inside my windows azure datatable. Im doing this in a windows phone 8 app using c#. Thanks

Upvotes: 0

Views: 1859

Answers (2)

林果皞
林果皞

Reputation: 7793

You should play around with this official graph API sandbox

https://developers.facebook.com/tools/explorer/?method=GET&path=me

More precisely, you have the access token, then you do

https://graph.facebook.com/me?access_token=YOUR_ACCESS_TOKEN

or only return id and username

https://graph.facebook.com/me?fields=username&access_token=YOUR_ACCESS_TOKEN

That's all.

Upvotes: 1

Richie
Richie

Reputation: 525

You need to access the Open Graph API. You can see a list of obtainable fields for a user here, user name being one of them.

If you're not already using a Facebook SDK of some sort Facebook SDK for .NET is great. Check out a great step by step tutorial using the following link. http://facebooksdk.net/docs/phone/tutorial The section titled "Personalize" will show you exactly what to do.

Upvotes: 1

Related Questions