Windows 8 识别WP8和Win8之间的用户帐户:ANID2与SafeCustomerId

Windows 8 识别WP8和Win8之间的用户帐户:ANID2与SafeCustomerId,windows-8,windows-runtime,windows-phone-8,microsoft-account,Windows 8,Windows Runtime,Windows Phone 8,Microsoft Account,我们有一个web服务,它需要识别用户访问其设备、wp8和win8 在手机端,我们有UserExtendedProperties.GetValue(“ANID2”),这是一个匿名的微软id Windows8上有OnlineIdAuthenticator.AuthenticateSarAsync和UserIdentity.SafeCustomerId以及其他属性,尽管它们看起来都不像ANID2 电话上存在OnlineIdAuthenticator api,但抛出NotImplementedExcep

我们有一个web服务,它需要识别用户访问其设备、wp8和win8

在手机端,我们有
UserExtendedProperties.GetValue(“ANID2”)
,这是一个匿名的微软id

Windows8上有
OnlineIdAuthenticator.AuthenticateSarAsync
UserIdentity.SafeCustomerId
以及其他属性,尽管它们看起来都不像ANID2

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

有没有办法在win8和wp8上获得一个公共用户标识符

谢谢

我知道的最好的方法(显然也是推荐的方法)是使用Azure移动服务()。有一个免费的计划,你可以使用。 使用移动服务,您可以使用MobileServiceClient()为每个用户获取唯一的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();
您可以在此处找到更多信息:
这里的SDK:

谢谢。有一个问题,这是否会导致登录提示(特别是在手机端)?是的,它会打开一个网页,提示用户登录。看起来像是标准的OAuth页面。就像OAuth一样,无法获取用户密码或电子邮件,因此您可以在将用户发送到登录页面之前记下这一点。如果你想看到它在行动,请查看统一。