我们有一个 Web 服务,需要跨设备、wp8 和 win8 识别用户。
在电话方面我们有UserExtendedProperties.GetValue("ANID2")
,其中获取的是匿名 Microsoft ID。
在Windows8上有OnlineIdAuthenticator.AuthenticateUserAsync
with UserIdentity.SafeCustomerId
和其他属性,尽管它们看起来都不像 ANID2。
OnlineIdAuthenticator api 存在于手机上,但抛出 NotImplementedException。
有什么方法可以在win8和wp8上获得通用的用户标识符吗?
Thanks
我知道的最好方法(这显然也是推荐的方法)是使用 Azure 移动服务(http://www.windowsazure.com/en-us/home/scenarios/mobile-services/ http://www.windowsazure.com/en-us/home/scenarios/mobile-services/)。您可以使用一个免费计划。
对于移动服务,您可以使用 MobileServiceClient (http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.mobileservices.mobileserviceclient.aspx http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.mobileservices.mobileserviceclient.aspx)为每个用户获取唯一的 ID(基于 MS 帐户)。
此代码获取用户 ID:
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 http://msdn.microsoft.com/en-us/library/jj863454.aspxSDK在这里:http://www.windowsazure.com/en-us/develop/mobile/developer-tools/ http://www.windowsazure.com/en-us/develop/mobile/developer-tools/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)