---
title: "prepareInterfaceToProvideCredential(for:)"
framework: authenticationservices
role: symbol
role_heading: Instance Method
path: "authenticationservices/ascredentialproviderviewcontroller/prepareinterfacetoprovidecredential(for:)-18ukb"
---

# prepareInterfaceToProvideCredential(for:)

Prepares the interface for a user interaction, like a database login, that enables it to access and return the credential for the given identity.

## Declaration

```swift
func prepareInterfaceToProvideCredential(for credentialIdentity: ASPasswordCredentialIdentity)
```

## Parameters

- `credentialIdentity`: The credential identity for which a credential should be provided.

## Discussion

Discussion The system calls this method when your extension can’t provide the requested credential without user interaction. Set up the view controller for any user interaction required to provide the requested credential. Limit user interaction to operations required for providing the requested credential, like showing an authentication UI to unlock the user’s passwords database. Call the context’s completeRequest(withSelectedCredential:completionHandler:) to provide the credential. 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

### Deprecated methods

- [provideCredentialWithoutUserInteraction(for:)](authenticationservices/ascredentialproviderviewcontroller/providecredentialwithoutuserinteraction(for:)-7jlg0.md)
