[UWP]需要登录用户的唯一标识符 [英] [UWP] Need unique identifier of logged in user

查看:84
本文介绍了[UWP]需要登录用户的唯一标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在努力开发其中一个应用的聊天,并且需要用户的唯一标识符来禁止未遵循应用指南的用户使用聊天功能。 我们不确定哪一个是确保用户被禁止的最佳标识符。 我们看了以下
,但都有问题:


1)  KnownUserProperties.AccountName - 使用AccountName作为所需属性的User.GetPropertiesAsync(desiredProperties)始终返回空字符串。


2)  NonRoamableId - 我们可以在OnLaunched的LaunchActivatedEventArgs中获得此值,但是,此值对于设备,用户和应用程序是唯一的。 如果用户远程更改设备或登录,则此值会更改。


3)  DeviceInfo.Instance.Id - 为设备提供唯一ID,但不为用户提供。 用户仍然可以更改设备以绕过禁止。


为什么开发人员无法获得为应用授予UserInformation权限后登录的AccountName? 是否有其他方法可以为登录用户获取唯一ID,以便我们可以禁止使用DeviceInfo.Instance.Id
和用户唯一ID的组合?

解决方案

您好,


应该可以获取AccountName属性。您是否在清单文件中启用了"用户帐户信息"和"企业身份验证"功能?


您还可以尝试官方示例  UserInfo   here。


祝你好运,


Roy


We are working on developing chat for one of our apps and need a unique identifier of the user to ban users who do not follow app guidelines for using the chat.  We aren't sure which one is the best identifier to ensure a user stays banned.  We've looked into the following and all have issues:

1)  KnownUserProperties.AccountName - Using User.GetPropertiesAsync(desiredProperties) with AccountName as desired property always returns empty string.

2)  NonRoamableId - We can get this value during OnLaunched's LaunchActivatedEventArgs, however, this value is unique to the device, user, and app.  If the user changes devices or logs in remotely, this value changes.

3)  DeviceInfo.Instance.Id - Provides a unique id for the device, but not for the user.  User can still change devices to bypass ban.

Why can't developers get the AccountName that is logged in once UserInformation permissions have been granted for the app?  Is there another way to get a unique id solely for the logged in user so that we can ban using a combination of DeviceInfo.Instance.Id and user's unique id?

解决方案

Hi,

It should be possbile to get the AccountName property. Have you enabled the userAccountInformation and Enterprise Authentication capability in the manifest file?

You could also try the official sample UserInfo here.

Best regards,

Roy


这篇关于[UWP]需要登录用户的唯一标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆