【问题标题】:identify user accross WP8 and Win8: ANID2 vs SafeCustomerId跨 WP8 和 Win8 识别用户:ANID2 vs SafeCustomerId
【发布时间】:2013-04-17 14:46:56
【问题描述】:

我们有一个网络服务需要在他的设备、wp8 和 win8 上识别用户。

在电话端我们有UserExtendedProperties.GetValue("ANID2"),它是匿名的微软ID。

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

OnlineIdAuthenticator api 存在于手机上,但抛出 NotImplementedException。

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

谢谢

【问题讨论】:

    标签: windows-8 windows-runtime windows-phone-8 microsoft-account


    【解决方案1】:

    我知道的最好方法(显然也是推荐的方法)是使用 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 帐户)。

    此代码获取用户 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/

    【讨论】:

    • 谢谢。一个问题,这会导致登录提示(尤其是在手机端)吗?
    • 是的,它会打开一个网页,提示用户登录。看起来像一个标准的 OAuth 页面。就像使用 OAuth 一样,无法获取用户密码或电子邮件,因此您可以在将用户发送到登录页面之前记下这一点。如果您想查看它的实际效果,请查看 Unification。
    猜你喜欢
    • 1970-01-01
    • 2013-06-09
    • 1970-01-01
    • 2018-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-30
    • 1970-01-01
    相关资源
    最近更新 更多