---
title: "cancelRequest(withError:)"
framework: authenticationservices
role: symbol
role_heading: Instance Method
path: "authenticationservices/ascredentialproviderextensioncontext/cancelrequest(witherror:)"
---

# cancelRequest(withError:)

Cancels the request.

## Declaration

```swift
func cancelRequest(withError error: any Error)
```

## Parameters

- `error`: Use an error domain of doc://com.apple.authenticationservices/documentation/AuthenticationServices/ASExtensionErrorDomain and a code of type doc://com.apple.authenticationservices/documentation/AuthenticationServices/ASExtensionError/Code.

## Mentioned in

Providing one-time passcodes to AutoFill

## Discussion

Discussion Call this method if the user cancels the action or if a failure occurs. The system dismisses your extension’s view controller automatically.
