---
title: "cancel(_:)"
framework: authenticationservices
role: symbol
role_heading: Instance Method
path: "authenticationservices/aswebauthenticationsessionwebbrowsersessionhandling/cancel(_:)"
---

# cancel(_:)

Cancels the process of handling the given request.

## Declaration

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

## Parameters

- `request`: The request to cancel.

## Mentioned in

Supporting Single Sign-On in a Web Browser App

## Discussion

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(_:) on the provided request object. Use ASWebAuthenticationSessionErrorDomain for the error domain and ASWebAuthenticationSessionError.Code.canceledLogin for the error code, unless another error happened that you need to communicate to the system.

## See Also

### Starting and Stopping a Session Request

- [begin(_:)](authenticationservices/aswebauthenticationsessionwebbrowsersessionhandling/begin(_:).md)
- [ASWebAuthenticationSessionRequest](authenticationservices/aswebauthenticationsessionrequest.md)
