---
title: "authorizationController(controller:didCompleteWithError:)"
framework: authenticationservices
role: symbol
role_heading: Instance Method
path: "authenticationservices/asauthorizationcontrollerdelegate/authorizationcontroller(controller:didcompletewitherror:)"
---

# authorizationController(controller:didCompleteWithError:)

Tells the delegate when authorization fails, and provides an error explaining why.

## Declaration

```swift
optional func authorizationController(controller: ASAuthorizationController, didCompleteWithError error: any Error)
```

## Parameters

- `controller`: The controller that performs the authorization attempt.
- `error`: An error that explains the failure using one of the codes in doc://com.apple.authenticationservices/documentation/AuthenticationServices/ASAuthorizationError-swift.struct/Code.

## Mentioned in

Supporting passkeys Supporting Security Key Authentication Using Physical Keys

## See Also

### Handling Authorization Errors

- [ASAuthorizationErrorDomain](authenticationservices/asauthorizationerrordomain.md)
- [ASAuthorizationError](authenticationservices/asauthorizationerror-swift.struct.md)
