Contents

prepareInterfaceToProvideCredential(for:)

Prepare the view controller to show user interface for providing the requested credential.

Declaration

func prepareInterfaceToProvideCredential(for credentialRequest: any ASCredentialRequest)

Parameters

  • credentialRequest:

    The credential request.

Mentioned in

Discussion

The system calls this method when your extension can’t supply the requested credential without user interaction. Limit user interaction to operations required for providing the requested credential, like showing an authentication UI to unlock the person’s passwords database.

Call the appropriate completion method on the extension context to provide the credential. For password credentials, call completeRequest(withSelectedCredential:completionHandler:). For passkey credentials, call completeAssertionRequest(using:completionHandler:). For one-time passcodes, call completeOneTimeCodeRequest(using:completionHandler:).

Alternatively, if an error occurs, call cancelRequest(withError:) instead and pass an error with domain ASExtensionErrorDomain and an appropriate error code from ASExtensionError.Code. For example, if your app can’t find the credential identity in the database, pass an error with code ASExtensionError.Code.credentialIdentityNotFound.

See Also

Selecting a credential