authentication - 如何使用 Xamarin.forms 使用 FaceID?

标签 authentication xamarin.forms face-id

我需要什么来实现 Face ID 身份验证才能在 Xamarin.forms 项目上运行?

最佳答案

您必须在 iOS 项目上本地执行此操作,然后使用 DependencyService 或某种 ioc 将其公开给您的 Forms 项目。

您必须将 NSFaceIDUsageDescription 键添加到您的 info.plist 中,否则应用程序在请求身份验证时会崩溃。

以下是在本地验证用户身份的代码片段:

var context = new LAContext();
LAContextReplyHandler replyHandler;
NSError AuthError;

if (context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out AuthError))
{
    replyHandler = new LAContextReplyHandler((success, error) =>
    {
        // Handle authentication success or error
    });
    // Authenticate and ask for permission if needed.
    context.EvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, "Authenticate", replyHandler);
}

关于authentication - 如何使用 Xamarin.forms 使用 FaceID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53629371/

相关文章:

c# - 密码哈希不匹配

Xamarin.Forms DatePicker 日期格式

ios - 在不实际使用 TouchID/FaceID 的情况下询问用户 TouchID/FaceID 许可

azure - .Net Core 和 Azure AD B2C 设置

http - 身份验证在 MAPI/HTTP 中如何工作

c# - Xamarin.Forms 中没有交互性的覆盖层

xamarin - 如何在CarouselPage中使用IndicatorView?

ios - 如何使用 iPhone X 的 faceID 数据

ios - 从后台返回时使用 FaceID 或 TouchID 对登录用户进行身份验证

authentication - 如何向未经身份验证/公共(public)用户发送信号器消息?