Contents

provideCredentialWithoutUserInteraction(for:)

Attempts to provide the user-requested credential with no further user interaction.

Declaration

func provideCredentialWithoutUserInteraction(for credentialRequest: any ASCredentialRequest)

Parameters

  • credentialRequest:

    The credential request.

Mentioned in

Discussion

After the person selects a credential identity, the system creates a credential request. The contents of the request depend on the type of credential requested. If the person requests a password or one-time passcode (OTP), the credential request (a ASPasswordCredentialRequest or ASOneTimeCodeCredentialRequest) contains a credential identity. If the person requests a passkey, the ASPasskeyCredentialRequest also contains information about the passkey assertion challenge.

The system calls provideCredentialWithoutUserInteraction(for:) to enhance the user experience. If your credential provider extension can provide the credential without user interaction, call the relevant completion method on the extension context. For password credential requests, call completeRequest(withSelectedCredential:completionHandler:). For passkey credential requests, call completeAssertionRequest(using:completionHandler:). For OTP requests, call completeOneTimeCodeRequest(using:completionHandler:).

If your extension requires user interaction to provide the credential, like when someone needs to unlock their credentials database, call cancelRequest(withError:). Use the error domain ASExtensionErrorDomain, and the code ASExtensionError.Code.userInteractionRequired.

If an error occurs, call cancelRequest(withError:) using the error domain ASExtensionErrorDomain and an appropriate code from ASExtensionError.Code.

As your view controller isn’t presented while the system calls this method, don’t show or use any user interface from this method.

See Also

Selecting a credential