---
title: "completeOneTimeCodeRequest(using:completionHandler:)"
framework: authenticationservices
role: symbol
role_heading: Instance Method
path: "authenticationservices/ascredentialproviderextensioncontext/completeonetimecoderequest(using:completionhandler:)"
---

# completeOneTimeCodeRequest(using:completionHandler:)

Provides the user-selected one-time passcode (OTP).

## Declaration

```swift
func completeOneTimeCodeRequest(using credential: ASOneTimeCodeCredential, completionHandler: (@Sendable (Bool) -> Void)? = nil)
```

```swift
func completeOneTimeCodeRequest(using credential: ASOneTimeCodeCredential) async -> Bool
```

## Parameters

- `credential`: The OTP credential chosen by the person.
- `completionHandler`: Optional work that the extension performs as a background priority task after the request completes. The expired parameter is YES if the system prematurely terminates a previous non-expiration invocation of the completionHandler.

## Mentioned in

Providing one-time passcodes to AutoFill

## Overview

Overview After calling this method, the system dismisses the associated view controller.

## See Also

### Providing credentials

- [completeRequest(withSelectedCredential:completionHandler:)](authenticationservices/ascredentialproviderextensioncontext/completerequest(withselectedcredential:completionhandler:).md)
- [completeAssertionRequest(using:completionHandler:)](authenticationservices/ascredentialproviderextensioncontext/completeassertionrequest(using:completionhandler:).md)
- [completeRegistrationRequest(using:completionHandler:)](authenticationservices/ascredentialproviderextensioncontext/completeregistrationrequest(using:completionhandler:).md)
- [ASPasswordCredential](authenticationservices/aspasswordcredential.md)
- [ASPasskeyAssertionCredential](authenticationservices/aspasskeyassertioncredential.md)
- [ASPasskeyRegistrationCredential](authenticationservices/aspasskeyregistrationcredential.md)
- [ASOneTimeCodeCredential](authenticationservices/asonetimecodecredential.md)
