Passwords have been the standard way to authenticate users in mobile and desktop applications for many years. However, password-based authentication introduces several challenges. Users forget passwords, reuse the same password across multiple services, and sometimes choose credentials that are easy to guess. Applications must also handle password resets, credential storage, and protection against phishing attacks.
Passkeys provide another approach to user authentication. Instead of asking users to remember a password, an application uses a public-private key pair. The private key is securely managed by the device's platform authenticator, while the server stores the corresponding public key.
Users can authenticate using familiar device security methods such as Face ID, Touch ID, Windows Hello, or an Android biometric prompt.
.NET MAUI 11 introduces a cross-platform Passkeys API that makes it easier to integrate native passkey authentication into applications. Developers can use the Passkeys class to register credentials and authenticate users through the operating system's native authentication interface.
In this article, we will explore how passkeys work, configure the required platform settings, implement passkey registration and sign-in, and understand the security responsibilities of the client application and backend server.
Understanding Passkeys
A passkey is a WebAuthn/FIDO2 public-key credential that allows users to authenticate without entering a traditional password.
When a user registers a passkey, the authenticator creates a cryptographic key pair.
The two keys have different responsibilities:
Private key: Remains securely managed by the platform authenticator and is used to sign authentication challenges.
Public key: Is sent to the application server and stored with the user's credential information.
The private key is not exposed to the .NET MAUI application.
When the user signs in, the server generates a challenge. The application passes the challenge to the platform authenticator, which asks the user to authenticate using the available device security mechanism.
After successful authentication, the authenticator signs the challenge with the private key. The application sends the resulting response to the server, which verifies the signature using the stored public key.
<text>Passkey authentication flow:</text>
User
|
| Selects Sign in with Passkey
|
.NET MAUI Application
|
| Requests authentication challenge
|
Backend Server
|
| Generates WebAuthn challenge
|
.NET MAUI Application
|
| Sends options to native authenticator
|
Device Authenticator
|
| Face ID / Touch ID / Android Biometrics
| Windows Hello / Security Key
|
| Signs authentication challenge
|
.NET MAUI Application
|
| Sends signed response
|
Backend Server
|
| Verifies challenge and signature
|
| Creates authenticated session
|
User Signed In
The important point is that the application does not authenticate the user by itself. The platform authenticator produces the cryptographic response, and the backend server verifies it.
What Is New in .NET MAUI 11?
.NET MAUI 11 introduces the Passkeys API in the Microsoft.Maui.Authentication namespace.
It provides a common interface for creating and using passkeys across supported platforms.
The main APIs are:
API | Purpose |
|---|
Passkeys.IsSupported
| Checks whether passkey functionality is supported on the current platform and operating system version |
Passkeys.CreateAsync()
| Starts passkey registration |
Passkeys.AssertAsync()
| Starts authentication using an existing passkey |
Passkeys.Default
| Provides the default passkey implementation |
IPasskeys
| Defines the passkey interface |
The API uses standard WebAuthn JSON.
This means your backend does not need to implement a completely different authentication protocol for every mobile platform. It can use an existing WebAuthn-compatible server library to generate options and verify responses.
The API is deliberately lightweight. It communicates with the native platform authenticator but does not generate challenges, validate signatures, or establish authenticated sessions.
This separation is important because security-sensitive verification must remain on the server.
Supported Platforms
The .NET MAUI 11 Passkeys API supports the following platforms and minimum operating system versions.
Platform | Minimum supported version | Native implementation |
|---|
Android | Android 14, API 34 | Jetpack Credential Manager |
iOS | iOS 16 | AuthenticationServices |
Mac Catalyst | Mac Catalyst 16 API; .NET MAUI 11 toolchain requires Mac Catalyst 17 | AuthenticationServices |
Windows | Windows 10 version 1903 | Windows WebAuthn API |
Support depends on the operating system version and the platform implementation.
For example, Android devices running Android 13 or earlier cannot use the built-in .NET MAUI Passkeys API, even if a separate credential provider is installed.
You should always check Passkeys.IsSupported before starting the authentication process.
using Microsoft.Maui.Authentication;
if (!Passkeys.IsSupported)
{
// Use an alternative authentication method.
}
This check only verifies platform and operating system support. It does not guarantee that a credential provider is configured, a biometric is enrolled, or a suitable passkey is available.
Configuring a .NET MAUI Project
Before writing the registration and sign-in code, configure the application for passkey authentication.
Passkeys are associated with a relying party, commonly called the RP. In a typical application, the RP is your authentication server's domain.
For example:
myapp.example.com
The application and backend must agree on the RP ID and the platform identity.
Android and Apple platforms require domain association configuration. Windows uses its HTTPS relying party origin directly.
You must also make sure that your backend supports WebAuthn registration and authentication.
Configuring Passkeys for Android
Android uses Jetpack Credential Manager to manage passkeys.
For a .NET MAUI application using the built-in Passkeys API, Android 14 or later is required.
You must configure Digital Asset Links so Android can verify the relationship between your application and the relying party domain.
Create the following file on your website:
https://myapp.example.com/.well-known/assetlinks.json
Add the application package name and signing certificate fingerprint.
[
{
"relation": [
"delegate_permission/common.get_login_creds"
],
"target": {
"namespace": "android_app",
"package_name": "com.example.myapp",
"sha256_cert_fingerprints": [
"AA:BB:CC:DD:11:22:33:44:55:66"
]
}
}
]
Replace the package name and fingerprint with the actual values from your Android application.
The fingerprint must match the certificate that signs the installed application.
Debug and release builds can use different signing certificates. Make sure the association file includes the fingerprints required for the builds you distribute.
The file must be publicly accessible over HTTPS and served as JSON without redirects or an authentication page.
Your backend must also accept the corresponding native Android origin:
android:apk-key-hash:<base64url-certificate-hash>
This is important because the origin used by a native Android application is different from a normal browser origin.
Configuring Passkeys for iOS
Apple uses the AuthenticationServices framework to provide native passkey functionality.
For iOS, configure the Associated Domains capability.
Open the iOS project configuration and add the following entitlement to Entitlements.plist:
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:myapp.example.com</string>
</array>
Replace the domain with your actual relying party domain.
Next, create the Apple App Site Association file at:
https://myapp.example.com/.well-known/apple-app-site-association
The file should contain your Apple Developer Team ID and application bundle identifier.
{
"webcredentials": {
"apps": [
"ABCDE12345.com.example.myapp"
]
}
}
For example, if your Team ID is ABCDE12345 and your bundle identifier is com.example.myapp, both values must match the application signing configuration.
You must also enable the Associated Domains capability for the App ID in your Apple Developer account and use a provisioning profile that includes this capability when signing physical-device builds.
The association file must be publicly available over HTTPS and served as JSON without redirects.
For Mac Catalyst, configure the corresponding entitlement and signing settings for that target as well.
Understanding the .NET MAUI Passkeys API
The main API is available through the Microsoft.Maui.Authentication namespace.
You can use the static Passkeys class:
using Microsoft.Maui.Authentication;
if (Passkeys.IsSupported)
{
// Passkey operations are available on this platform.
}
There are two main operations.
Registration uses CreateAsync() to create a new credential.
Authentication uses AssertAsync() to sign in with an existing credential.
Both methods accept WebAuthn options JSON generated by the backend server.
The response is also returned as standard WebAuthn JSON, which can be sent back to the server for verification.
Implementing Passkey Registration
Passkey registration should happen after the user has authenticated through an existing sign-in method or completed account creation.
For example, a user may sign in with a password and then select Add Passkey from the account security screen.
The registration process has three main steps:
Request registration options from the backend.
Use the native authenticator to create the credential.
Send the generated response to the backend for verification and storage.
Consider the following implementation.
using System.Text;
using Microsoft.Maui.Authentication;
public class PasskeyService
{
private readonly HttpClient _httpClient;
public PasskeyService(HttpClient httpClient)
{
_httpClient = httpClient;
}
public async Task<bool> RegisterAsync(
CancellationToken cancellationToken = default)
{
if (!Passkeys.IsSupported)
{
return false;
}
// Request registration options from the backend.
using var beginResponse = await _httpClient.PostAsync(
"/passkeys/register/begin",
content: null,
cancellationToken);
beginResponse.EnsureSuccessStatusCode();
var optionsJson =
await beginResponse.Content.ReadAsStringAsync(
cancellationToken);
// Open the native passkey registration interface.
var creationResponse = await Passkeys.CreateAsync(
optionsJson,
cancellationToken);
// Send the WebAuthn response to the backend.
using var content = new StringContent(
creationResponse.ToString(),
Encoding.UTF8,
"application/json");
using var finishResponse = await _httpClient.PostAsync(
"/passkeys/register/finish",
content,
cancellationToken);
finishResponse.EnsureSuccessStatusCode();
return true;
}
}
The backend generates the registration challenge and returns the WebAuthn creation options.
The Passkeys.CreateAsync() method passes those options to the operating system. The user then completes the native registration process.
After the authenticator creates the credential, the API returns a PasskeyCreationResponse.
The application sends the response to the backend.
An important detail is the use of StringContent with application/json. The ToString() method already returns the WebAuthn response JSON. Do not pass that string directly to PostAsJsonAsync, because it can serialize the JSON string as a quoted JSON value instead of sending the original JSON document.
The backend must verify the response before storing the public key and credential information.
Implementing Passkey Sign-In
After registration, users can sign in using their passkeys.
The authentication process is similar to registration, but it uses AssertAsync() instead of CreateAsync().
using System.Text;
using Microsoft.Maui.Authentication;
public class PasskeyService
{
private readonly HttpClient _httpClient;
public PasskeyService(HttpClient httpClient)
{
_httpClient = httpClient;
}
public async Task<bool> SignInAsync(
CancellationToken cancellationToken = default)
{
if (!Passkeys.IsSupported)
{
return false;
}
// Request authentication options from the backend.
using var beginResponse = await _httpClient.PostAsync(
"/passkeys/login/begin",
content: null,
cancellationToken);
beginResponse.EnsureSuccessStatusCode();
var optionsJson =
await beginResponse.Content.ReadAsStringAsync(
cancellationToken);
// Authenticate through the native platform authenticator.
var assertionResponse = await Passkeys.AssertAsync(
optionsJson,
cancellationToken);
// Send the assertion response to the backend.
using var content = new StringContent(
assertionResponse.ToString(),
Encoding.UTF8,
"application/json");
using var finishResponse = await _httpClient.PostAsync(
"/passkeys/login/finish",
content,
cancellationToken);
finishResponse.EnsureSuccessStatusCode();
return true;
}
}
The backend generates a fresh authentication challenge and returns the request options.
The operating system displays the appropriate authentication interface. Depending on the device, the user may authenticate with Face ID, Touch ID, an Android credential provider, Windows Hello, or a compatible security key.
After successful authentication, the API returns a PasskeyAssertionResponse.
The application sends this response to the backend, which verifies the signature and challenge.
Only after successful server-side verification should the application treat the user as authenticated.
The example uses a Boolean return value to keep the flow simple. In a production application, the service should return a structured authentication result containing the session or token information issued by the backend.
Implementing a Sign-In ViewModel
A production application should not place all authentication logic directly inside a button click handler.
Use a ViewModel or application service to manage the operation.
For example:
using System.ComponentModel;
using System.Runtime.CompilerServices;
public class LoginViewModel : INotifyPropertyChanged
{
private readonly PasskeyService _passkeyService;
private bool _isBusy;
private string _message = string.Empty;
public LoginViewModel(PasskeyService passkeyService)
{
_passkeyService = passkeyService;
}
public bool IsBusy
{
get => _isBusy;
set
{
if (_isBusy == value)
return;
_isBusy = value;
OnPropertyChanged();
}
}
public string Message
{
get => _message;
set
{
if (_message == value)
return;
_message = value;
OnPropertyChanged();
}
}
public async Task SignInWithPasskeyAsync()
{
if (IsBusy)
return;
try
{
IsBusy = true;
Message = string.Empty;
var success =
await _passkeyService.SignInAsync();
Message = success
? "Authentication completed."
: "Passkeys are not supported on this device.";
}
catch (OperationCanceledException)
{
Message = "Passkey authentication was cancelled.";
}
catch (Exception ex)
{
Message = "Unable to sign in with a passkey.";
// Log the exception for diagnostics.
}
finally
{
IsBusy = false;
}
}
public event PropertyChangedEventHandler? PropertyChanged;
private void OnPropertyChanged(
[CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(
this,
new PropertyChangedEventArgs(propertyName));
}
}
This ViewModel separates the user interface from authentication operations.
However, the example is intentionally simplified. The PasskeyService must return the authenticated session or token issued by the server before the application can navigate to a protected screen.
A Boolean indicating that an HTTP request completed successfully is not sufficient proof of authentication unless the backend has already verified the assertion and established the session.
Understanding the Backend Responsibilities
One of the most important parts of passkey implementation is the backend.
The .NET MAUI Passkeys API only communicates with the native authenticator. It does not verify the cryptographic response.
Your backend must implement the WebAuthn relying party responsibilities.
A typical backend exposes four endpoints.
Endpoint | Responsibility |
|---|
POST /passkeys/register/begin
| Generates registration options and a challenge |
POST /passkeys/register/finish
| Verifies registration and stores the credential |
POST /passkeys/login/begin
| Generates authentication options and a challenge |
POST /passkeys/login/finish
| Verifies the assertion and establishes a session |
During registration, the backend should:
Generate a cryptographically secure challenge.
Associate the challenge with the authenticated user and registration session.
Validate the challenge returned by the authenticator.
Validate the relying party ID and expected origin.
Validate the attestation according to the application's security policy.
Store the credential ID and public key.
Store the user handle and relevant credential metadata.
During sign-in, the backend should:
Generate a new challenge.
Identify the allowed credentials when appropriate.
Validate the returned challenge.
Validate the relying party ID and origin.
Verify the assertion signature using the stored public key.
Check credential ownership and applicable authenticator metadata.
Update the signature counter where applicable.
Establish an authenticated session only after successful verification.
A WebAuthn-compatible backend library should handle the cryptographic and protocol details. Avoid implementing signature verification manually.
ASP.NET Core Identity provides passkey-related support through its WebAuthn integration. You can also use a dedicated WebAuthn relying party library when your backend architecture requires it.
Storing Passkey Information in the Database
The server must store the public credential information required to verify future authentication requests.
A simplified database structure might look like this:
CREATE TABLE UserPasskeys
(
Id BIGINT IDENTITY PRIMARY KEY,
UserId BIGINT NOT NULL,
CredentialId NVARCHAR(1024) NOT NULL,
PublicKey NVARCHAR(MAX) NOT NULL,
UserHandle NVARCHAR(512) NULL,
SignatureCounter BIGINT NOT NULL DEFAULT 0,
CreatedAt DATETIME2 NOT NULL DEFAULT SYSUTCDATETIME(),
LastUsedAt DATETIME2 NULL,
DeviceName NVARCHAR(150) NULL,
IsActive BIT NOT NULL DEFAULT 1
);
This example is a simplified SQL Server schema. The exact columns and data types should follow the requirements of your WebAuthn library.
The credential ID should be stored in a form that preserves its binary value, commonly as binary data or a correctly encoded representation.
The public key is not a password or private secret. However, credential records are security-sensitive and should be protected against unauthorized modification or deletion.
A user may register more than one passkey. For example, they may have one associated with a mobile phone and another associated with a laptop.
Allow users to view registered credentials, identify them with understandable names, and revoke credentials they no longer use.
Handling Passkey Errors
Passkey operations can fail for several reasons.
The user may cancel the authentication prompt, the device may not support the API, or the platform may not find a suitable credential.
A production application should handle these cases separately where the platform provides enough information.
try
{
var response = await Passkeys.AssertAsync(
optionsJson,
cancellationToken);
// Send the response to the backend for verification.
}
catch (FeatureNotSupportedException)
{
// Offer another sign-in method.
}
catch (OperationCanceledException)
{
// Return to the sign-in screen.
}
catch (ArgumentException ex)
{
// Log invalid WebAuthn options.
}
catch (InvalidOperationException ex)
{
// Log native credential or platform errors.
}
There are important platform differences.
On Android, an unavailable credential can be reported through InvalidOperationException.
On iOS and Mac Catalyst, an unavailable credential and a user dismissing the prompt can both appear as cancellation.
Therefore, do not assume that every OperationCanceledException means the user deliberately rejected passkey authentication.
Keep the alternative sign-in method accessible and avoid displaying raw platform exception messages to users.
Security Best Practices
Always Verify Passkey Responses on the Server
Never trust a response simply because CreateAsync() or AssertAsync() completed successfully.
The client only collects the authenticator response. The backend must verify the challenge, relying party ID, origin, and cryptographic signature.
If the server does not verify the response, the application does not have secure passkey authentication.
Generate a Unique Challenge for Every Ceremony
The backend should generate a fresh, cryptographically secure challenge for each registration or authentication attempt.
A challenge should be short-lived, associated with the correct user and session, and accepted only once.
This helps prevent replay attacks.
Configure Native Application Origins Correctly
Browser-based WebAuthn uses a browser origin. Native applications use platform-specific origins.
Android uses an origin derived from the application's signing certificate.
Apple platforms use an associated-domain HTTPS origin.
Your backend must explicitly accept the expected native origins. A ceremony can complete successfully on the device and still fail when the server rejects the returned origin.
Keep a Fallback Authentication Method
Not every device supports the .NET MAUI Passkeys API.
Some users may also have no passkey registered or may choose not to use one.
Keep an appropriate alternative, such as an existing password-based or recovery authentication flow.
Support Multiple Passkeys
Do not assume that one account has only one passkey.
Users may have several devices or use different credential providers. Provide a way to register additional passkeys and revoke credentials.
Keep the Relying Party ID Stable
Passkeys are associated with a relying party ID.
Changing the domain or RP ID can make existing credentials unusable for the new configuration.
Choose the authentication domain carefully before releasing the feature to production.
Protect the Authentication Session
The server should establish an authenticated session only after successful assertion verification.
For native applications, use an appropriate token-based authentication design rather than depending on browser cookies as the only session mechanism.
Common Mistakes When Implementing Passkeys
Mistake | Why it causes problems | Recommended approach |
|---|
Trusting the client response | The client does not verify WebAuthn signatures | Verify every response on the backend |
Skipping domain association | Android and Apple cannot establish the required trust relationship | Configure Digital Asset Links and Associated Domains |
Using the wrong signing fingerprint | Android cannot match the installed app with the domain association | Register the correct debug and release fingerprints |
Using a browser origin for native authentication | The backend rejects the platform-generated origin | Configure the expected native origin |
Sending serialized JSON incorrectly | The backend receives a JSON string instead of a WebAuthn response object | Send ToString() through raw JSON content |
Supporting only one credential | Users may lose access when a device is replaced | Support multiple credentials and revocation |
Removing alternative sign-in | Older devices and unsupported environments cannot authenticate | Maintain a fallback authentication flow |
Treating cancellation as a failure | Users may simply have dismissed the native interface | Handle cancellation without blocking other sign-in methods |
Advantages and Disadvantages of Passkeys in .NET MAUI
Advantages | Disadvantages |
|---|
Reduces dependence on traditional passwords | Requires backend WebAuthn implementation |
Uses native authentication interfaces | Requires platform-specific domain association |
Supports Face ID, Touch ID, Android authenticators, and Windows Hello | Older operating system versions may not be supported |
Private keys remain managed by the authenticator | Credential recovery and account recovery still require careful design |
Uses a standard WebAuthn protocol | Debug and release signing configurations must be handled correctly |
Provides a consistent API across supported platforms | Platform error behavior is not identical |
Summary
Passkeys provide a modern authentication approach that reduces dependence on traditional passwords while using the security capabilities already available on user devices.
.NET MAUI 11 simplifies passkey integration through the Passkeys API in the Microsoft.Maui.Authentication namespace. Developers can use CreateAsync() to register credentials and AssertAsync() to authenticate users through the native platform authenticator.
However, successful implementation requires more than calling these methods. Android needs Digital Asset Links configuration, Apple platforms need Associated Domains, and the backend must implement WebAuthn challenge generation and response verification.
The most important architectural decision is to keep cryptographic verification on the server. The MAUI application should only coordinate the native authentication process and send the resulting response to the backend.
When combined with proper domain configuration, secure challenge handling, multiple credential support, and a reliable recovery mechanism, passkeys can provide a practical passwordless authentication experience across supported .NET MAUI platforms.
Join the conversation! Your thoughts help the community grow.