跨 WP8 和 Win8 识别用户:ANID2 与 SafeCustomerId
我们有一个网络服务,需要识别用户在他的设备、wp8 和 win8 上的身份.
We have a web service that needs to indentify a user accross his devices, wp8, and win8.
在电话方面,我们有 UserExtendedProperties.GetValue("ANID2")
,它是匿名的微软 ID.
On the phone side we have UserExtendedProperties.GetValue("ANID2")
, which get's the anonymous microsoft id.
在 Windows8 上有 OnlineIdAuthenticator.AuthenticateUserAsync
和 UserIdentity.SafeCustomerId
和其他属性,尽管它们都不像 ANID2.
On Windows8 there's OnlineIdAuthenticator.AuthenticateUserAsync
with UserIdentity.SafeCustomerId
and other properties, though none of them look like the ANID2.
OnlineIdAuthenticator api 存在于手机上,但抛出 NotImplementedException.
The OnlineIdAuthenticator api exists on phone, but throws NotImplementedException.
有没有办法在 win8 和 wp8 上获得一个通用的用户标识符?
Is there any way to get a common user identifier on win8 and wp8?
谢谢
我所知道的最好方法(显然也是推荐的方法)是使用 Azure 移动服务 (http://www.windowsazure.com/en-us/home/scenarios/mobile-services/).有一个免费计划可供您使用.通过移动服务,您可以使用 MobileServiceClient (http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.mobileservices.mobileserviceclient.aspx) 以获得每个用户的唯一 ID(基于 MS 帐户).
The best way I know (it's apparently the recommended way too) is to use Azure Mobile Services (http://www.windowsazure.com/en-us/home/scenarios/mobile-services/). There is a free plan that you can use. With Mobile Services you can use the MobileServiceClient (http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.mobileservices.mobileserviceclient.aspx) to get a unique ID for each user (based on the MS account).
此代码获取用户 ID:
This code gets the user 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和这里的 SDK:http://www.windowsazure.com/en-us/develop/mobile/developer-tools/
You can find some more information here: http://msdn.microsoft.com/en-us/library/jj863454.aspx and the SDK here: http://www.windowsazure.com/en-us/develop/mobile/developer-tools/