identify user accross WP8 and Win8: ANID2 vs SafeCustomerId

早过忘川 提交于 2019-12-07 17:23:18

问题


We have a web service that needs to indentify a user accross his devices, wp8, and win8.

On the phone side we have UserExtendedProperties.GetValue("ANID2"), which get's the anonymous microsoft id.

On Windows8 there's OnlineIdAuthenticator.AuthenticateUserAsync with UserIdentity.SafeCustomerId and other properties, though none of them look like the ANID2.

The OnlineIdAuthenticator api exists on phone, but throws NotImplementedException.

Is there any way to get a common user identifier on win8 and wp8?

Thanks


回答1:


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).

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();

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/



来源:https://stackoverflow.com/questions/16063193/identify-user-accross-wp8-and-win8-anid2-vs-safecustomerid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!