Method BeginRegistrationAsync
BeginRegistrationAsync(PasskeyUser, string?, bool, CancellationToken)
Starts creating a passkey for a user.
Declaration
public Task<PasskeyCeremony> BeginRegistrationAsync(PasskeyUser user, string? codeChallenge = null, bool excludeExistingPasskeys = true, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| PasskeyUser | user | The user to create the passkey for. |
| string | codeChallenge | The client's PKCE code challenge (S256, base64url) to bind the registration to, if any. The registered passkey carries it as CodeChallenge, so the registration can continue with a sign-in code bound to the same challenge. |
| bool | excludeExistingPasskeys | Whether the options list the user's passkeys as credentials to exclude, which asks the authenticator not to create a passkey if it already has one of them. If false, the user's passkeys are not looked up, and an authenticator that has one of them creates a new one. Authenticators keep one discoverable passkey per user and relying party, so a new discoverable passkey replaces the one that the authenticator, or its sync provider, held for the user, and the record of the replaced passkey no longer has a passkey behind it. Default is true. |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<PasskeyCeremony> |
Exceptions
| Type | Condition |
|---|---|
| BadRequestApiException | The code challenge is malformed (CodeChallengeInvalid). |