<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AuthenticationServices",
  "identifier" : "/documentation/AuthenticationServices/ASWebAuthenticationSessionWebBrowserSessionHandling/cancel(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Authentication Services"
    ],
    "preciseIdentifier" : "c:objc(pl)ASWebAuthenticationSessionWebBrowserSessionHandling(im)cancelWebAuthenticationSessionRequest:"
  },
  "title" : "cancel(_:)"
}
-->

# cancel(_:)

Cancels the process of handling the given request.

```
func cancel(_ request: ASWebAuthenticationSessionRequest!)
```

## Parameters

`request`

The request to cancel.

## Discussion

Your browser app implements this method to accept cancellation requests from the initiating app.

When you’ve finished your app’s teardown activities in your implementation of this method, call [`cancelWithError(_:)`](/documentation/AuthenticationServices/ASWebAuthenticationSessionRequest/cancelWithError(_:)) on the provided request object. Use [`ASWebAuthenticationSessionErrorDomain`](/documentation/AuthenticationServices/ASWebAuthenticationSessionErrorDomain) for the error domain and [`ASWebAuthenticationSessionError.Code.canceledLogin`](/documentation/AuthenticationServices/ASWebAuthenticationSessionError/Code/canceledLogin) for the error code, unless another error happened that you need to communicate to the system.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)