Method CreateAsync
CreateAsync(SignInCodes, VerifiedPasskey, string?, CancellationToken)
Creates a one-time sign-in code for the user of a passkey sign-in, bound to the PKCE code challenge the sign-in began with, so that the client redeems it with the same code verifier.
Declaration
public static Task<string> CreateAsync(this SignInCodes signInCodes, VerifiedPasskey passkey, string? appData = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| SignInCodes | signInCodes | The sign-in codes service. |
| VerifiedPasskey | passkey | The passkey that FinishSignInAsync(string, string, string?, CancellationToken) verified. |
| string | appData | An optional value of the app's that the code carries (see CreateAsync(string, string, string?, CancellationToken)). |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<string> |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The passkey was not verified by a sign-in that began with a code challenge, which can only happen when RequireCodeChallenge is false or the passkey comes from a verification. |
CreateAsync(SignInCodes, RegisteredPasskey, string?, CancellationToken)
Creates a one-time sign-in code for the user of a passkey registration, bound to the PKCE code challenge the registration began with, so that the client redeems it with the matching code verifier.
Declaration
public static Task<string> CreateAsync(this SignInCodes signInCodes, RegisteredPasskey passkey, string? appData = null, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| SignInCodes | signInCodes | The sign-in codes service. |
| RegisteredPasskey | passkey | The passkey that FinishRegistrationAsync(string, string, string, string?, CancellationToken) registered. |
| string | appData | An optional value of the app's that the code carries (see CreateAsync(string, string, string?, CancellationToken)). |
| CancellationToken | cancellationToken | A token to cancel the operation. |
Returns
| Type | Description |
|---|---|
| Task<string> |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The registration did not begin with a code challenge. |