从.NET Backend Azure Mobile Service中的身份验证令牌获取名称,电子邮件ID等用户信息

Shi*_*ngh 4 c# authentication azure azure-mobile-services

我正在使用Azure移动服务向我的Windows应用商店应用添加身份验证.根据移动服务文档中的这篇文章,我能够获得UserId以及MobileServiceAuthenticationToken(包括Google和Microsoft帐户)

我的问题是如何在后端移动服务中获取用户信息name, email Id等.我已经阅读了各种文章,解释了如何在Backend移动服务中完成此操作,但在后端移动服务中找不到任何正确实现的内容.MobileServiceAuthenticationToken.NETJavascriptC# + .NET

任何指针赞赏.

谢谢

Ara*_*yan 7

Facebook,Google在授权时不会返回您的用户个人资料名称,电子邮件.他们给你的access token是可以用于未来的请求.

您需要申请Facebook Graph API以获取name, email您的MobileServiceAuthenticationToken.

您可以使用此库访问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"]);
Run Code Online (Sandbox Code Playgroud)