<!--
{
  "availability" : [
    "iOS: 17.4.0 -",
    "iPadOS: 17.4.0 -",
    "macCatalyst: 17.4.0 -",
    "macOS: 14.4.0 -",
    "tvOS: 17.4.0 -",
    "visionOS: 1.1.0 -",
    "watchOS: 10.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AuthenticationServices",
  "identifier" : "/documentation/AuthenticationServices/ASWebAuthenticationSession/Callback/matchesURL(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Authentication Services"
    ],
    "preciseIdentifier" : "c:objc(cs)ASWebAuthenticationSessionCallback(im)matchesURL:"
  },
  "title" : "matchesURL(_:)"
}
-->

# matchesURL(_:)

Checks whether a given URL matches the callback object.

```
func matchesURL(_ url: URL) -> Bool
```

## Discussion

Use this method in a browser app that adopts the `ASWebAuthenticationWebBrowser` API.
Other apps can use it for debugging purposes.

The following example shows how a browser app’s internal method for determining redirect policies might use `matchesURL(_:)`:

```swift
// The pre-existing delegate method, which the system calls when the web browser receives a request from an app.
func begin(_ request: ASWebAuthenticationSessionRequest!) {
    self.request = request

    // Load the URL request.
}

// The web browser's internal method for determining redirect policies.
func myShouldNavigate(to url: URL) -> Bool {
    if request.callback.matches(url) {
        // Existing API to complete a request.
        request.complete(withCallbackURL: url)
    }
    ...
}
```

---

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)