我们有一个Web服务,需要识别用户的设备wp8和win8。

在电话方面,我们有UserExtendedProperties.GetValue("ANID2"),它是匿名Microsoft ID。

在Windows8上,具有OnlineIdAuthenticator.AuthenticateUserAsync和其他属性的UserIdentity.SafeCustomerId,尽管它们看起来都不像ANID2。

电话上存在OnlineIdAuthenticator api,但抛出NotImplementedException。

有什么方法可以在win8和wp8上获取公共用户标识符?

谢谢

最佳答案

我知道的最好方法(显然也是推荐的方法)是使用Azure移动服务(http://www.windowsazure.com/en-us/home/scenarios/mobile-services/)。您可以使用免费计划。
使用Mobile Services,您可以使用MobileServiceClient(http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.mobileservices.mobileserviceclient.aspx)为每个用户获取唯一的ID(基于MS帐户)。

此代码获取用户标识:

MobileServiceClient client = new MobileServiceClient(serviceUri);
MobileServiceUser user = await client.LoginAsync(MobileServiceAuthenticationProvider.MicrosoftAccount);

/* The user ID contains the provider name and the ID seperated by a colon */
var userId = user.UserId.Split(':').Last();


您可以在此处找到更多信息:http://msdn.microsoft.com/en-us/library/jj863454.aspx
和此处的SDK:http://www.windowsazure.com/en-us/develop/mobile/developer-tools/

07-28 02:55
查看更多