I am using Azure Mobile Service to add authentication to my Windows Store app. Following this article from Mobile Services documentation I am able to get the UserId as well as MobileServiceAuthenticationToken
(both for Google as well as Microsoft Account)
My question is how do I get user info like name, email Id
etc. using MobileServiceAuthenticationToken
in a .NET
backend mobile service. I have gone through various articles explaining how this is done in Javascript
Backend mobile service but couldn't find anything properly implemented in C# + .NET
backend mobile service.
Any pointers appreciated.
Thanks
Facebook, Google doesn't return you user profile name, e-mail when authorizing. They are giving you access token
that can be used for future requests.
You need to request for example to Facebook Graph API for name, email
with your MobileServiceAuthenticationToken
.
You can use this library for accessing to Facebook API: https://facebookgraphapi.codeplex.com/
// MobileServiceAuthenticationToken <- your token
var facebook = new FacebookGraphAPI(MobileServiceAuthenticationToken);
// Get user profile data
var user = facebook.GetObject("me", null);
Console.WriteLine(user["name"]);